diff --git a/trytond/ir/ui/menu.py b/trytond/ir/ui/menu.py index d3d83c9d50..c5056c5a04 100644 --- a/trytond/ir/ui/menu.py +++ b/trytond/ir/ui/menu.py @@ -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(): diff --git a/trytond/tests/mptt.py b/trytond/tests/mptt.py index 62e8ee20ea..2805b552fc 100644 --- a/trytond/tests/mptt.py +++ b/trytond/tests/mptt.py @@ -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():