From be2926de630f8547dc2e25d4060f79cf299bf533 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 21 Oct 2010 18:31:31 +0200 Subject: [PATCH] [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 --- bin/osv/fields.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 724077aadfa..664f51128ee 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -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: