[FIX] fields.many2many: get() should ignore "string" domains, meant for client-side eval (pending API change later to make the distinction explicit?)

bzr revid: odo@openerp.com-20101021163131-bbmtpygtwton3acv
This commit is contained in:
Olivier Dony 2010-10-21 18:31:31 +02:00
parent b0dcc6f515
commit be2926de63
1 changed files with 7 additions and 1 deletions

View File

@ -542,7 +542,13 @@ class many2many(_column):
warnings.warn("Specifying offset at a many2many.get() may produce unpredictable results.",
DeprecationWarning, stacklevel=2)
obj = obj.pool.get(self._obj)
wquery = obj._where_calc(cr, user, self._domain, context=context)
# static domains are lists, and are evaluated both here and on client-side, while string
# domains supposed by dynamic and evaluated on client-side only (thus ignored here)
# FIXME: make this distinction explicit in API!
domain = isinstance(self._domain, list) and self._domain or []
wquery = obj._where_calc(cr, user, domain, context=context)
obj._apply_ir_rules(cr, user, wquery, 'read', context=context)
from_c, where_c, where_params = wquery.get_sql()
if where_c: