diff options
| author | Géry Debongnie <ged@odoo.com> | 2018-12-06 12:39:06 +0000 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2018-12-07 13:16:06 +0000 |
| commit | 40dd121938552d3f88289d2e5fcd1d57a0dd01bb (patch) | |
| tree | 4830c8ffdea1e10d35c7ddf096f536bd8999240f /addons/web/static/src/js/views/abstract_model.js | |
| parent | 48a50b4bc011fc6dfc82a673f921fad941dc79cf (diff) | |
[REF] web: move ControlPanel inside controllers/actions
This branch introduces a large-scale reorganization of the
component tree generated by the web client. The short version is
that now, the control panel is a child of the view controller and
no longer a sibling. Graphically (and simplified), we go from
this:
webClient
/ | \
... ... actionManager
/ \
controlPanel viewController
/ \
to this:
webClient
/ | \
... ... actionManager
|
viewController
/ | \
ControlPanelController
/ \
CPRenderer CPModel
The motivation is that this work moves the code where it should be.
Before this commit, it was kind of weird to have code in the
controllers to render buttons outside of their root node (in
renderButtons). Also, the action manager had to take care of
coordinating search view states between view transitions.
So, this work simplifies the code. It also makes it easier to
extend. We see day after day that Odoo needs to take care of more
complex UI needs, and in many cases, these needs were quite
difficult to implement (we prefer spaghettis in our plates, not in
our code). The changes in this branch should open the way to
implement these features.
For example,
- it will now be easy to add the possibility of views (for example,
the search view or a new ControlPanel view) to add custom buttons
(of type action or object) in the control panel.
- Another need will be to serialize/ restore the state of the
search view across action boundaries (needed by the dashboard).
- Another example is the possibility for views to customize easily
the presence/absence of sub menus (filters/groupbys/favorites/
time range/...)
- Another need is an easier way for views/client action to customize
their control panel.
This commit also contains a large rewrite of the search view (so it
is more inline with our architecture and easier to maintain).
Part of task 1893568
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/abstract_model.js')
| -rw-r--r-- | addons/web/static/src/js/views/abstract_model.js | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/addons/web/static/src/js/views/abstract_model.js b/addons/web/static/src/js/views/abstract_model.js index 4ea6b217e65..da73ac664a3 100644 --- a/addons/web/static/src/js/views/abstract_model.js +++ b/addons/web/static/src/js/views/abstract_model.js @@ -14,52 +14,21 @@ odoo.define('web.AbstractModel', function (require) { * in order to be able to notify its parent by bubbling events up. */ -var Class = require('web.Class'); var fieldUtils = require('web.field_utils'); -var mixins = require('web.mixins'); -var ServicesMixin = require('web.ServicesMixin'); - -var AbstractModel = Class.extend(mixins.EventDispatcherMixin, ServicesMixin, { - /** - * @param {Widget} parent - */ - init: function (parent) { - mixins.EventDispatcherMixin.init.call(this); - this.setParent(parent); - }, +var mvc = require('web.mvc'); +var AbstractModel = mvc.Model.extend({ //-------------------------------------------------------------------------- // Public //-------------------------------------------------------------------------- /** - * This method should return the complete state necessary for the renderer - * to display the currently viewed data. - * - * @returns {*} - */ - get: function () { - }, - /** - * The load method is called once in a model, when we load the data for the - * first time. The method returns (a deferred that resolves to) some kind - * of token/handle. The handle can then be used with the get method to - * access a representation of the data. - * - * @param {Object} params - * @param {string} params.modelName the name of the model - * @returns {Deferred} The deferred resolves to some kind of handle - */ - load: function (params) { - return $.when(); - }, - /** * When something changes, the data may need to be refetched. This is the * job for this method: reloading (only if necessary) all the data and * making sure that they are ready to be redisplayed. * * @param {Object} params - * @returns {Deferred} + * @returns {Promise} */ reload: function (params) { return $.when(); |
