From abaa3ac63eea90bd61478053ec02db4f0e816e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 13 Jul 2015 23:58:42 +0200 Subject: [PATCH] Remove boolean expression in order issue4852 review15541002 --- product.py | 5 +++-- purchase.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/product.py b/product.py index 06d067d32b..83cda784b4 100644 --- a/product.py +++ b/product.py @@ -4,6 +4,7 @@ import datetime from sql import Literal, Null from sql.aggregate import Count +from sql.conditionals import Case from trytond.model import ModelView, ModelSQL, MatchMixin, fields from trytond.pyson import Eval, If @@ -222,7 +223,7 @@ class ProductSupplier(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_company(): @@ -331,7 +332,7 @@ class ProductSupplierPrice(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_quantity(): diff --git a/purchase.py b/purchase.py index 3b2a76e383..2bdcd24e0f 100644 --- a/purchase.py +++ b/purchase.py @@ -8,6 +8,7 @@ from sql import Table, Literal, Null from sql.functions import Overlay, Position from sql.aggregate import Count from sql.operators import Concat +from sql.conditionals import Case from trytond.model import Workflow, ModelView, ModelSQL, fields from trytond.modules.company import CompanyReport @@ -990,7 +991,7 @@ class PurchaseLine(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():