diff --git a/addons/web/static/src/js/view_tree.js b/addons/web/static/src/js/view_tree.js index 2f92042c4d0..380f1609a33 100644 --- a/addons/web/static/src/js/view_tree.js +++ b/addons/web/static/src/js/view_tree.js @@ -222,27 +222,25 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie var local_context = { active_model: self.dataset.model, active_id: id, - active_ids: [id]}; + active_ids: [id] + }; + var ctx = instance.web.pyeval.eval( + 'context', new instance.web.CompoundContext( + this.dataset.get_context(), local_context)); return this.rpc('/web/treeview/action', { id: id, model: this.dataset.model, - context: instance.web.pyeval.eval( - 'context', new instance.web.CompoundContext( - this.dataset.get_context(), local_context)) + context: ctx }).then(function (actions) { if (!actions.length) { return; } var action = actions[0][2]; - var c = new instance.web.CompoundContext(local_context); + var c = new instance.web.CompoundContext(local_context).set_eval_context(ctx); if (action.context) { c.add(action.context); } - return instance.web.pyeval.eval_domains_and_contexts({ - contexts: [c], domains: [] - }).then(function (res) { - action.context = res.context; - return self.do_action(action); - }, null); - }, null); + action.context = c; + return self.do_action(action); + }); }, // show & hide the contents diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py index 9112fc4f947..1aeb3703a10 100644 --- a/openerp/addons/base/ir/ir_actions.py +++ b/openerp/addons/base/ir/ir_actions.py @@ -316,7 +316,6 @@ class ir_actions_act_window(osv.osv): 'auto_search':True, 'multi': False, } - def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): """ call the method get_empty_list_help of the model and set the window action help message """ @@ -325,24 +324,22 @@ 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) - 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 in self.pool: - 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: - continue - if not fields or 'help' in fields: + 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 custom_context = dict(context, **eval_context) res['help'] = self.pool[model].get_empty_list_help(cr, uid, res.get('help', ""), context=custom_context) if ids_int: