From 679983672d9afe72e6a19494598b8eb558dcd8cc Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 18 Oct 2011 13:50:40 +0200 Subject: [PATCH] [FIX] Action buttons does not include active_id in context when loading action lp bug: https://launchpad.net/bugs/871771 fixed bzr revid: fme@openerp.com-20111018115040-66l0xiudl8yt8khq --- addons/web/static/src/js/views.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 32e17db641f..4094d1019bb 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -854,15 +854,19 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{ return self.widget_parent.on_action_executed.apply(null, arguments); } }; + var context = new db.web.CompoundContext(dataset.get_context()); + if (record_id) { + context.add({ + active_id: record_id, + active_ids: [record_id], + active_model: dataset.model + }); + } var handler = function (r) { var action = r.result; if (action && action.constructor == Object) { return self.rpc('/web/session/eval_domain_and_context', { - contexts: [dataset.get_context(), action.context || {}, { - active_id: record_id || false, - active_ids: [record_id || false], - active_model: dataset.model - }], + contexts: [context, action.context || {}], domains: [] }).pipe(function (results) { if (!action_data.context) { @@ -878,8 +882,6 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{ } }; - var context = new db.web.CompoundContext(dataset.get_context(), action_data.context || {}); - if (action_data.special) { return handler({result: {"type":"ir.actions.act_window_close"}}); } else if (action_data.type=="object") {