From 12f5aa0a1874e765f927b2fab293c2c5f0ad2652 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Mon, 29 Nov 2010 20:34:13 +0200 Subject: [PATCH] expression: fix "m2o, m2m in []" expressions, bug 626806 After some discussions, we decided that the desired behavior of the ORM for one2many and many2many fields should be: (foobar_id,'in', []) => empty result, because the list is empty (foobar_id,'in',False) => find records that don't have a foobar bzr revid: p_christ@hol.gr-20101129183413-yi1jzdwr1tis7d8t --- bin/osv/expression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/osv/expression.py b/bin/osv/expression.py index cb1280c8e3b..3281fd29f7c 100644 --- a/bin/osv/expression.py +++ b/bin/osv/expression.py @@ -185,7 +185,7 @@ class expression(object): else: call_null = True - if right: + if right is not False: if isinstance(right, basestring): ids2 = [x[0] for x in field_obj.name_search(cr, uid, right, [], operator, context=context, limit=None)] if ids2: @@ -234,7 +234,7 @@ class expression(object): self.__exp[i] = ('id', 'in', _rec_convert(ids2)) else: call_null_m2m = True - if right: + if right is not False: if isinstance(right, basestring): res_ids = [x[0] for x in field_obj.name_search(cr, uid, right, [], operator, context=context)] if res_ids: