From 9aa648513e06e71fb15fa288df4b1835cfbadfcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 19 Feb 2016 12:43:12 +0100 Subject: [PATCH] re-add the use of the case removed in changeset 0c62b08fa917 Removing the case resulted in the evaluation of expression that were not valid like the cast of a string into an integer. issue5335 review16011002 --- trytond/model/fields/property.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/trytond/model/fields/property.py b/trytond/model/fields/property.py index 10a82a66f3..4cac9078b8 100644 --- a/trytond/model/fields/property.py +++ b/trytond/model/fields/property.py @@ -4,6 +4,7 @@ import copy from sql import Cast, Literal, Null from sql.functions import Substring, Position +from sql.conditionals import Case from .function import Function from .field import Field, SQL_OPERATORS @@ -97,7 +98,11 @@ class Property(Function): Position(',', property_.res) + Literal(1)), Model.id.sql_type().base), property_.id, - where=cond & self.get_condition(sql_type, domain, property_))) + # Use a Case because the condition created by get_condition + # could result in an invalid Cast + where=Case( + (cond, self.get_condition(sql_type, domain, property_)), + else_=(Literal(1) == Literal(0))))) props = cursor.fetchall() default = None