[FIX]Expression.py corrected when M2O search returns no IDs

bzr revid: ach@tinyerp.com-20100512112620-yrralz7xovn0uxee
This commit is contained in:
Anup (OpenERP) 2010-05-12 16:56:20 +05:30
parent 22f85f783a
commit 2205170823
1 changed files with 5 additions and 2 deletions

View File

@ -280,8 +280,11 @@ class expression(object):
c = context.copy()
c['active_test'] = False
res_ids = field_obj.name_search(cr, uid, right, [], operator, limit=None, context=c)
right = map(lambda x: x[0], res_ids)
self.__exp[i] = (left, 'in', right)
if not res_ids:
self.__exp[i] = ('id','=',0)
else:
right = map(lambda x: x[0], res_ids)
self.__exp[i] = (left, 'in', right)
else:
# other field type
# add the time part to datetime field when it's not there: