summaryrefslogtreecommitdiff
path: root/addons/web/static
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2016-02-26 11:18:40 +0100
committerGéry Debongnie <ged@odoo.com>2016-03-09 13:01:34 +0100
commit8a47095a609f190890a8be06fb4656f13b43c5e9 (patch)
tree6dc4b5e62111a83eadcca71dcc6d5f42b087e88a /addons/web/static
parenta82413fb7a04cd8144c413ea4ab3be5d05e82559 (diff)
[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.
Diffstat (limited to 'addons/web/static')
-rw-r--r--addons/web/static/src/js/action_manager.js16
-rw-r--r--addons/web/static/src/js/view_manager.js20
2 files changed, 19 insertions, 17 deletions
diff --git a/addons/web/static/src/js/action_manager.js b/addons/web/static/src/js/action_manager.js
index 5eb5aaa9891..be7f9fa93d6 100644
--- a/addons/web/static/src/js/action_manager.js
+++ b/addons/web/static/src/js/action_manager.js
@@ -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',
diff --git a/addons/web/static/src/js/view_manager.js b/addons/web/static/src/js/view_manager.js
index 6d9abc2bc9a..9f3a62ecdcf 100644
--- a/addons/web/static/src/js/view_manager.js
+++ b/addons/web/static/src/js/view_manager.js
@@ -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 = [];