Remove boolean expression in order

issue4852
review15541002
This commit is contained in:
Cédric Krier
2015-07-13 23:56:52 +02:00
parent f455a9b6ed
commit 2f4bf93817
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
from itertools import groupby
from sql import Null
from sql.conditionals import Case
from trytond.model import ModelView, ModelSQL, fields
from trytond.transaction import Transaction
@@ -296,7 +297,7 @@ class UIMenuFavorite(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_user():
+2 -1
View File
@@ -2,6 +2,7 @@
# this repository contains the full copyright notices and license terms.
"Test for Tree"
from sql import Null
from sql.conditionals import Case
from trytond.model import ModelView, ModelSQL, fields
@@ -29,7 +30,7 @@ class MPTT(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():