+ call_null = True
+
+ 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:
+ operator = 'in'
+ else:
+ if not isinstance(right,list):
+ ids2 = [right]
+ else:
+ ids2 = right
+ if not ids2:
+ if operator in ['like','ilike','in','=']:
+ #no result found with given search criteria
+ call_null = False
+ self.__exp[i] = ('id','=',0)
+ else:
+ call_null = True
+ operator = 'in' # operator changed because ids are directly related to main object
+ else:
+ call_null = False
+ o2m_op = 'in'
+ if operator in ['not like','not ilike','not in','<>','!=']:
+ o2m_op = 'not in'
+ self.__exp[i] = ('id', o2m_op, self.__execute_recursive_in(cr, field._fields_id, field_obj._table, 'id', ids2, operator, field._type))
+
+ if call_null:
+ o2m_op = 'not in'
+ if operator in ['not like','not ilike','not in','<>','!=']:
+ o2m_op = 'in'
+ self.__exp[i] = ('id', o2m_op, self.__execute_recursive_in(cr, field._fields_id, field_obj._table, 'id', [], operator, field._type) or [0])