Remove boolean expression in order

issue4852
review15541002
This commit is contained in:
Cédric Krier
2015-07-13 23:58:26 +02:00
parent 1ee98449ae
commit 8b966513af
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -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():
+2 -1
View File
@@ -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():