expression: bugfix with many2many fields

bzr revid: christophe@tinyerp.com-20080818125800-tbv8obinijtgrasd
This commit is contained in:
Christophe Simonis 2008-08-18 14:58:00 +02:00
parent 3242b0cfee
commit 2f6e14b151
2 changed files with 7 additions and 3 deletions

View File

@ -144,8 +144,10 @@ class expression(object):
if field_obj == table:
return ids
return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids)
self.__exp[i] = ('id', 'in', _rec_convert(ids2 + _rec_get(ids2, field_obj, working_table._parent_name)))
dom = _rec_get(ids2, field_obj, working_table._parent_name)
ids2 = field_obj.search(cr, uid, doms, context=context)
self.__exp[i] = ('id', 'in', _rec_convert(ids2))
else:
if isinstance(right, basestring):
res_ids = [x[0] for x in field_obj.name_search(cr, uid, right, [], operator)]
@ -161,7 +163,7 @@ class expression(object):
self.__operator = 'in'
if field._obj != working_table._name:
dom = _rec_get(ids2, field_obj, working_table._parent_name, left=left, prefix=left+'.')
dom = _rec_get(ids2, field_obj, working_table._parent_name,)
else:
dom = _rec_get(ids2, working_table, left)
self.__exp = self.__exp[:i] + dom + self.__exp[i+1:]

View File

@ -2333,6 +2333,8 @@ class orm(orm_template):
# compute the where, order by, limit and offset clauses
(qu1, qu2, tables) = self._where_calc(cr, user, args, context=context)
print "self: %r\nqu1: %r\nqu2: %r\ntables: %r\n" % (self, qu1, qu2, tables,)
if len(qu1):
qu1 = ' where '+string.join(qu1, ' and ')
else: