Fix search on many2many, if there is no record matching

bzr revid: ced-3a1c70a85fa449dbe606e293a35fbc71e7e01d4d
This commit is contained in:
ced 2007-08-29 04:47:50 +00:00
parent b18412dca5
commit 85b8870c42
1 changed files with 4 additions and 3 deletions

View File

@ -1549,9 +1549,10 @@ class orm(object):
else:
res_ids = args[i][2]
if not len(res_ids):
return []
cr.execute('select "'+field._id1+'" from "'+field._rel+'" where "'+field._id2+'" in ('+','.join(map(str, res_ids))+')')
args[i] = ('id', 'in', map(lambda x: x[0], cr.fetchall()))
args[i] = ('id', 'in', [0])
else:
cr.execute('select "'+field._id1+'" from "'+field._rel+'" where "'+field._id2+'" in ('+','.join(map(str, res_ids))+')')
args[i] = ('id', 'in', map(lambda x: x[0], cr.fetchall()))
i+=1
elif field._type=='many2one':