diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-11-17 13:14:02 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-01-16 20:49:19 +0100 |
| commit | 32b8cec5361174c92c45a4975d4e02f1fb448aa2 (patch) | |
| tree | 110bd6986c2da1ed5047002b7ea40c91ea9fa5ed /addons/web/static/src/js/views/abstract_view.js | |
| parent | 9bee25a9df65f657fef0f2f32a7ad823fdc7d4e1 (diff) | |
[REF] web,*: ActionManager/ViewManager refactoring
This rev. is the first part (out of 3) of the refactoring of the
ActionManager and ViewManager layer of the webclient.
The main changes are:
- there is no ViewManager anymore, its work is now handled by the
ActionManager itself, but isolated in a specific file ; this
eases a lot of things, as the breadcrumbs handling for example.
- the ActionManager code is converted to the new coding principles
and guidelines ; mainly, children widgets communicate with it by
triggering events up, and not by function calls anymore.
- the ActionManager layer is now testable, and a lot of tests have
already been written.
- the code in other addons has been adapted consequently.
What's coming next:
- introduce the 'AbstractAction' Widget, and make client actions
and view controllers inherit from it ; this widget will
implement a common API that could be used uniformly by the
ActionManager (e.g. restore(), canBeLeft(), renderButtons(),
getTitle()...).
- move the ControlPanel handling from the ActionManager to the
AbstractAction.
Diffstat (limited to 'addons/web/static/src/js/views/abstract_view.js')
| -rw-r--r-- | addons/web/static/src/js/views/abstract_view.js | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/abstract_view.js b/addons/web/static/src/js/views/abstract_view.js index 2a1ba16a33e..58b2c85a670 100644 --- a/addons/web/static/src/js/views/abstract_view.js +++ b/addons/web/static/src/js/views/abstract_view.js @@ -67,11 +67,18 @@ var AbstractView = Class.extend({ * @param {string} params.modelName The actual model name * @param {Object} params.context * @param {number} [params.count] + * @param {string} [params.controllerID] * @param {string[]} params.domain * @param {string[]} params.groupBy * @param {number} [params.currentId] * @param {number[]} [params.ids] + * @param {boolean} [params.withControlPanel] + * @param {boolean} [params.action.flags.headless] + * @param {string} [params.action.display_name] + * @param {string} [params.action.name] * @param {string} [params.action.help] + * @param {string} [params.action.jsID] + * @param {boolean} [params.action.views] */ init: function (viewInfo, params) { this.rendererParams = { @@ -87,7 +94,23 @@ var AbstractView = Class.extend({ delete: viewInfo.arch.attrs.delete ? JSON.parse(viewInfo.arch.attrs.delete) : true, duplicate: viewInfo.arch.attrs.duplicate ? JSON.parse(viewInfo.arch.attrs.duplicate) : true, }, + controllerID: params.controllerID, }; + // AAB: these params won't be necessary as soon as the ControlPanel will + // be instantiated by the View + this.controllerParams.displayName = params.action && (params.action.display_name || params.action.name); + this.controllerParams.isMultiRecord = this.multi_record; + this.controllerParams.searchable = this.searchable; + this.controllerParams.searchView = params.action && params.action.searchView; + this.controllerParams.searchViewHidden = this.searchview_hidden; // AAB: use searchable instead where it is used? + this.controllerParams.actionViews = params.action ? params.action.views : []; + this.controllerParams.viewType = this.viewType; + this.controllerParams.withControlPanel = true; + if (params.action && params.action.flags) { + this.controllerParams.withControlPanel = !params.action.flags.headless; + } else if ('withControlPanel' in params) { + this.controllerParams.withControlPanel = params.withControlPanel; + } this.loadParams = { context: params.context, @@ -133,7 +156,7 @@ var AbstractView = Class.extend({ * load itself, and the renderer needs the data in its constructor. * * @param {Widget} parent The parent of the resulting Controller (most - * likely a view manager) + * likely an action manager) * @returns {Deferred} The deferred resolves to a controller */ getController: function (parent) { |
