From 220517082345862716e388ed9e7557c33e105db0 Mon Sep 17 00:00:00 2001 From: "Anup (OpenERP)" Date: Wed, 12 May 2010 16:56:20 +0530 Subject: [PATCH] [FIX]Expression.py corrected when M2O search returns no IDs bzr revid: ach@tinyerp.com-20100512112620-yrralz7xovn0uxee --- bin/osv/expression.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/osv/expression.py b/bin/osv/expression.py index 4e6e1aade6f..2ca19bbf418 100644 --- a/bin/osv/expression.py +++ b/bin/osv/expression.py @@ -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: