[FIX] expression: pass context to hierarchical domain operators

The expression context is currently passed to to_ids() but is missing
from all calls to child_of_domain() or parent_of_domain().  These
methods are effectively always passed a context of None.

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>

Closes #13688 (part 1/2)
This commit is contained in:
Michael Brown
2016-10-06 17:51:28 +02:00
committed by Olivier Dony
parent 1b3d60d961
commit 22c4a0c1b0
+6 -6
View File
@@ -828,7 +828,7 @@ class expression(object):
elif left == 'id' and operator in HIERARCHY_FUNCS:
ids2 = to_ids(right, model, context)
dom = HIERARCHY_FUNCS[operator](left, ids2, model)
dom = HIERARCHY_FUNCS[operator](left, ids2, model, context=context)
for dom_leaf in reversed(dom):
new_leaf = create_substitution_leaf(leaf, dom_leaf, model)
push(new_leaf)
@@ -949,9 +949,9 @@ class expression(object):
elif column._type == 'one2many' and operator in HIERARCHY_FUNCS:
ids2 = to_ids(right, comodel, context)
if column._obj != model._name:
dom = HIERARCHY_FUNCS[operator](left, ids2, comodel, prefix=column._obj)
dom = HIERARCHY_FUNCS[operator](left, ids2, comodel, prefix=column._obj, context=context)
else:
dom = HIERARCHY_FUNCS[operator]('id', ids2, model, parent=left)
dom = HIERARCHY_FUNCS[operator]('id', ids2, model, parent=left, context=context)
for dom_leaf in reversed(dom):
push(create_substitution_leaf(leaf, dom_leaf, model))
@@ -1007,7 +1007,7 @@ class expression(object):
return select_from_where(cr, rel_id1, rel_table, rel_id2, ids, operator)
ids2 = to_ids(right, comodel, context)
dom = HIERARCHY_FUNCS[operator]('id', ids2, comodel)
dom = HIERARCHY_FUNCS[operator]('id', ids2, comodel, context=context)
ids2 = comodel.search(cr, uid, dom, context=context)
push(create_substitution_leaf(leaf, ('id', 'in', _rec_convert(ids2)), model))
else:
@@ -1046,9 +1046,9 @@ class expression(object):
if operator in HIERARCHY_FUNCS:
ids2 = to_ids(right, comodel, context)
if column._obj != model._name:
dom = HIERARCHY_FUNCS[operator](left, ids2, comodel, prefix=column._obj)
dom = HIERARCHY_FUNCS[operator](left, ids2, comodel, prefix=column._obj, context=context)
else:
dom = HIERARCHY_FUNCS[operator]('id', ids2, model, parent=left)
dom = HIERARCHY_FUNCS[operator]('id', ids2, model, parent=left, context=context)
for dom_leaf in reversed(dom):
push(create_substitution_leaf(leaf, dom_leaf, model))
else: