summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ledoux <dle@openerp.com>2014-05-28 15:50:02 +0200
committerDenis Ledoux <dle@openerp.com>2014-05-28 15:50:02 +0200
commit6ed774de614a2977a8d186a14ef2cd45a76e7a2e (patch)
tree6b0251ede3f67cc45cec1bca86e918ba02a10c92
parentf085274d5f321d0c90d6ad34a28f573539df4ba6 (diff)
[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
-rw-r--r--addons/web/static/src/js/views.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index 228a0b3e8f2..196e8a18f38 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;