summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/services
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2018-12-06 12:39:06 +0000
committerGéry Debongnie <ged@odoo.com>2018-12-07 13:16:06 +0000
commit40dd121938552d3f88289d2e5fcd1d57a0dd01bb (patch)
tree4830c8ffdea1e10d35c7ddf096f536bd8999240f /addons/web/static/src/js/services
parent48a50b4bc011fc6dfc82a673f921fad941dc79cf (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/services')
-rw-r--r--addons/web/static/src/js/services/core.js2
-rw-r--r--addons/web/static/src/js/services/data_manager.js23
2 files changed, 14 insertions, 11 deletions
diff --git a/addons/web/static/src/js/services/core.js b/addons/web/static/src/js/services/core.js
index 522d6b07302..3d6cfc4e684 100644
--- a/addons/web/static/src/js/services/core.js
+++ b/addons/web/static/src/js/services/core.js
@@ -39,8 +39,6 @@ return {
// registries
action_registry : new Registry(),
crash_registry: new Registry(),
- search_filters_registry: new Registry(),
- search_widgets_registry: new Registry(),
serviceRegistry: new Registry(),
/**
* @type {String}
diff --git a/addons/web/static/src/js/services/data_manager.js b/addons/web/static/src/js/services/data_manager.js
index bb7f25d206b..afedaa1148f 100644
--- a/addons/web/static/src/js/services/data_manager.js
+++ b/addons/web/static/src/js/services/data_manager.js
@@ -128,15 +128,20 @@ return core.Class.extend({
*
* @param {Object} [dataset] the dataset for which the filters are loaded
* @param {int} [action_id] the id of the action (optional)
+ * @param {Object} params
+ * @param {string} params.modelName
+ * @param {Object} params.context
+ * @param {integer} params.actionId
* @return {Deferred} resolved with the requested filters
*/
- load_filters: function (dataset, action_id) {
- var key = this._gen_key(dataset.model, action_id);
+ load_filters: function (params) {
+ var key = this._gen_key(params.modelName, params.actionId);
if (!this._cache.filters[key]) {
this._cache.filters[key] = rpc.query({
- args: [dataset.model, action_id],
+ args: [params.modelName, params.actionId],
kwargs: {
- context: dataset.get_context(),
+ context: params.context || {},
+ // get_context() de dataset
},
model: 'ir.filters',
method: 'get_filters',
@@ -158,26 +163,26 @@ return core.Class.extend({
model: 'ir.filters',
method: 'create_or_replace',
})
- .then(function (filter_id) {
+ .then(function (filterId) {
var key = [
filter.model_id,
filter.action_id || false,
].join(',');
self._invalidate(self._cache.filters, key);
- return filter_id;
+ return filterId;
});
},
/**
* Calls 'unlink' on 'ir_filters'.
*
- * @param {Object} [filter] the description of the filter to remove
+ * @param {integer} filterId, Id of the filter to remove
* @return {Deferred}
*/
- delete_filter: function (filter) {
+ delete_filter: function (filterId) {
var self = this;
return rpc.query({
- args: [filter.id],
+ args: [filterId],
model: 'ir.filters',
method: 'unlink',
})