Skip to content
Snippets Groups Projects
Commit 7ad2eb35 authored by Richard Mathot's avatar Richard Mathot
Browse files

[IMP] base: use current context when evaluation ir_actions' context

parent 1870fa81
Branches
Tags
No related merge requests found
......@@ -320,22 +320,26 @@ class ir_actions_act_window(osv.osv):
ids = [ids]
results = super(ir_actions_act_window, self).read(cr, uid, ids, fields=fields, context=context, load=load)
if not fields or 'help' in fields:
context = dict(context or {})
eval_dict = {
'active_model': context.get('active_model'),
'active_id': context.get('active_id'),
'active_ids': context.get('active_ids'),
'uid': uid,
}
for res in results:
model = res.get('res_model')
if model and self.pool.get(model):
try:
with tools.mute_logger("openerp.tools.safe_eval"):
eval_context = eval(res['context'] or "{}", eval_dict) or {}
except Exception:
continue
context = dict(context or {})
eval_dict = {
'active_model': context.get('active_model'),
'active_id': context.get('active_id'),
'active_ids': context.get('active_ids'),
'uid': uid,
'context': context,
}
for res in results:
model = res.get('res_model')
if model and self.pool.get(model):
try:
with tools.mute_logger("openerp.tools.safe_eval"):
eval_context = eval(res['context'] or "{}", eval_dict) or {}
res['context'] = str(eval_context)
except Exception:
_logger.warning("ir_actions: Cannot evaluate context = %s with eval_dict = %s"
% (res['context'] or "{}", eval_dict), exc_info=True)
continue
if not fields or 'help' in fields:
custom_context = dict(context, **eval_context)
res['help'] = self.pool.get(model).get_empty_list_help(cr, uid, res.get('help', ""), context=custom_context)
if ids_int:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment