[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 a37bad205b
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
This commit is contained in:
Denis Ledoux 2014-05-28 15:50:02 +02:00
parent f085274d5f
commit 6ed774de61
1 changed files with 14 additions and 11 deletions

View File

@ -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;