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
This commit is contained in:
P. Christeas 2010-11-29 20:34:13 +02:00
parent 0f1ab5e6ef
commit 12f5aa0a18
1 changed files with 2 additions and 2 deletions

View File

@ -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: