From 8b966513af421fccee6033aff4f2060d2aa43399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 13 Jul 2015 23:58:26 +0200 Subject: [PATCH] Remove boolean expression in order issue4852 review15541002 --- address.py | 3 ++- contact_mechanism.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/address.py b/address.py index f1c54a8cd1..6f127d6178 100644 --- a/address.py +++ b/address.py @@ -2,6 +2,7 @@ # this repository contains the full copyright notices and license terms. 'Address' from sql import Null +from sql.conditionals import Case from trytond.model import ModelView, ModelSQL, fields from trytond.pyson import Eval, If @@ -63,7 +64,7 @@ class Address(ModelSQL, ModelView): @staticmethod def order_sequence(tables): table, _ = tables[None] - return [table.sequence == Null, table.sequence] + return [Case((table.sequence == Null, 0), else_=1), table.sequence] @staticmethod def default_active(): diff --git a/contact_mechanism.py b/contact_mechanism.py index 38c91f93f4..32fb3145a9 100644 --- a/contact_mechanism.py +++ b/contact_mechanism.py @@ -1,6 +1,7 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. from sql import Null +from sql.conditionals import Case from trytond.model import ModelView, ModelSQL, fields from trytond.pyson import Eval @@ -104,7 +105,7 @@ class ContactMechanism(ModelSQL, ModelView): @staticmethod def order_sequence(tables): table, _ = tables[None] - return [table.sequence == Null, table.sequence] + return [Case((table.sequence == Null, 0), else_=1), table.sequence] @staticmethod def default_type():