From 6ed774de614a2977a8d186a14ef2cd45a76e7a2e Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 28 May 2014 15:50:02 +0200 Subject: [PATCH] [FIX] web: on new ir actions act_window target current, change the active* params from context for the dataset only This fix is related to a37bad205b13cec4f19f8e84e28801278e3e36ca This previous fix did solved the issue of its purpose, but had a side effect for actions using these active* params, e.g. search views For instance, Go to Project > Projects, click on any project, you are than redirected to tasks/issues of this project If you reload the page, an error pops up, complaining that active_id cannot be found --- addons/web/static/src/js/views.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 228a0b3..196e8a1 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -436,16 +436,6 @@ instance.web.ActionManager = instance.web.Widget.extend({ ir_actions_act_window: function (action, options) { var self = this; - if (action.target === 'current'){ - action.context['active_model'] = action.res_model; - if (action.res_id){ - action.context['active_id'] = action.res_id; - action.context['active_ids'] = [action.res_id]; - } else{ - delete action.context['active_id']; - delete action.context['active_ids']; - } - } return this.ir_actions_common({ widget: function () { return new instance.web.ViewManagerAction(self, action); }, action: action, @@ -892,7 +882,20 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ this._super(parent, null, action.views, flags); this.session = parent.session; this.action = action; - var dataset = new instance.web.DataSetSearch(this, action.res_model, action.context, action.domain); + var context = action.context; + if (action.target === 'current'){ + var active_context = { + active_model: action.res_model, + }; + context = new instance.web.CompoundContext(context, active_context).eval(); + delete context['active_id']; + delete context['active_ids']; + if (action.res_id){ + context['active_id'] = action.res_id; + context['active_ids'] = [action.res_id]; + } + } + var dataset = new instance.web.DataSetSearch(this, action.res_model, context, action.domain); if (action.res_id) { dataset.ids.push(action.res_id); dataset.index = 0; -- 1.7.10.4