Remove boolean expression in order

issue4852
review15541002
This commit is contained in:
Cédric Krier
2015-07-13 23:57:43 +02:00
parent a5dec6e906
commit 5af5a4c834
3 changed files with 7 additions and 5 deletions
+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 ModelSQL, ModelView, MatchMixin, fields
from trytond.pyson import Eval
@@ -59,7 +60,7 @@ class ConfigurationTaxRounding(ModelSQL, ModelView, MatchMixin):
@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_method():
+2 -2
View File
@@ -1565,7 +1565,7 @@ class InvoiceLine(ModelSQL, ModelView, TaxableMixin):
@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_currency():
@@ -2085,7 +2085,7 @@ class InvoiceTax(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_base():
+3 -2
View File
@@ -4,6 +4,7 @@ from decimal import Decimal
from dateutil.relativedelta import relativedelta
from sql import Null, Column
from sql.conditionals import Case
from trytond.model import ModelView, ModelSQL, fields
from trytond import backend
@@ -175,7 +176,7 @@ class PaymentTermLine(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_currency_digits():
@@ -358,7 +359,7 @@ class PaymentTermLineRelativeDelta(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_months():