[REF] web: view_manager's init

Always initialize a view_manager with its dataset and views, but without the
action (at least explicitely, as the action might still be given within the
options).

This is a backport of changes in enterprise to keep the view_manager's API
similar in both repository, which is required the large refactoring that will
arrive.
This commit is contained in:
Aaron Bohy
2016-03-09 13:01:34 +01:00
committed by Géry Debongnie
parent a82413fb7a
commit 8a47095a60
2 changed files with 19 additions and 17 deletions
+15 -1
View File
@@ -703,9 +703,23 @@ var ActionManager = Widget.extend({
},
ir_actions_act_window: function (action, options) {
var self = this;
var flags = action.flags || {};
if (!('auto_search' in flags)) {
flags.auto_search = action.auto_search !== false;
}
options.action = action;
options.action_manager = this;
var dataset = new data.DataSetSearch(this, action.res_model, action.context, action.domain);
if (action.res_id) {
dataset.ids.push(action.res_id);
dataset.index = 0;
}
var views = action.views;
return this.ir_actions_common({
widget: function () {
return new ViewManager(self, null, null, null, action, options);
return new ViewManager(self, dataset, views, flags, options);
},
action: action,
klass: 'o_act_window',
+4 -16
View File
@@ -16,28 +16,16 @@ var _t = core._t;
var ViewManager = Widget.extend(ControlPanelMixin, {
template: "ViewManager",
/**
* @param {Object} [dataset] null object (... historical reasons)
* @param {Object} [dataset]
* @param {Array} [views] List of [view_id, view_type]
* @param {Object} [flags] various boolean describing UI state
*/
init: function(parent, dataset, views, flags, action, options) {
if (action) {
flags = action.flags || {};
if (!('auto_search' in flags)) {
flags.auto_search = action.auto_search !== false;
}
this.action = action;
this.action_manager = parent;
dataset = new data.DataSetSearch(this, action.res_model, action.context, action.domain);
if (action.res_id) {
dataset.ids.push(action.res_id);
dataset.index = 0;
}
views = action.views;
}
init: function(parent, dataset, views, flags, options) {
var self = this;
this._super(parent);
this.action = options && options.action;
this.action_manager = options && options.action_manager;
this.flags = flags || {};
this.dataset = dataset;
this.view_order = [];