Correctly evaluate domain between xxx2many and None

The value of empty xxx2many is an empty list which must be comparable to None.

issue7163
review43171002
This commit is contained in:
Cédric Krier committed 2018-03-04 00:52:32 +01:00
1 parent 9dbb4ba61f
commit ccdf16cc31
1 file changed
+5
+5
View File
@@ -70,6 +70,8 @@ def eval_leaf(part, context, boolop=operator.and_):
context_field = datetime.datetime.min
else:
context_field = datetime.date.min
if isinstance(context_field, (list, tuple)) and value is None:
value = type(context_field)()
if (isinstance(context_field, basestring)
and isinstance(value, (list, tuple))):
try:
@@ -584,6 +586,9 @@ def test_evaldomain():
assert eval_domain(domain, {'x': [1, 2]})
assert not eval_domain(domain, {'x': [2]})
domain = [['x', '=', None]]
assert eval_domain(domain, {'x': []})
def test_localize():
domain = [['x', '=', 5]]