Reviewers: ,
Please review this at http://codereview.tryton.org/746002/
Affected files:
M tryton/common/domain_inversion.py
Index: tryton/common/domain_inversion.py
===================================================================
--- a/tryton/common/domain_inversion.py
+++ b/tryton/common/domain_inversion.py
@@ -50,9 +50,9 @@
def eval_leaf(part, context, boolop=operator.and_):
field, operand, value = part[:3]
if '.' in field:
- # In the case where the leaf concerns a m2o then having a value in
the
- # evaluation context is deemed suffisant
- return bool(context.get(field.split('.')[0]))
+ # In the case where the leaf concerns a m2o then we should
consider it
+ # as always correct
+ return True
if operand == '=' and not context.get(field) and boolop ==
operator.and_:
# We should consider that other domain inversion will set a correct
# value to this field
@@ -494,6 +494,10 @@
assert not eval_domain(domain, {'x': ('test', 2)})
assert not eval_domain(domain, {'x': 'test,2'})
+ domain = [['x.y', '=', 1]]
+ assert eval_domain(domain, {'x': 'test'})
+ assert eval_domain(domain, {'x': None})
+
def test_localize():
domain = [['x', '=', 5]]