[IMP] base: use current context when evaluation ir_actions' context
This commit is contained in:
parent
1870fa813d
commit
7ad2eb354d
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue