summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/services/data_manager.js
diff options
context:
space:
mode:
authorJulien Mougenot <jum@odoo.com>2020-03-11 09:38:28 +0000
committerJulien Mougenot <jum@odoo.com>2020-03-13 14:08:33 +0000
commit18e5416636b19b0953b1e6e26bfaeab1ebecce4c (patch)
tree5be75af26f1707a5b8b2184545719f3628d2980f /addons/web/static/src/js/services/data_manager.js
parentfbf347498f1cc7b74ef373179b7bcae201715c24 (diff)
[REF] web: Adapt views/actions to new control panel
Some web actions/controllers/viewsl have been adapted to properly instantiate the newly refactored control panel and update it accordingly. We needed to adapt the starting mechanism of actions and controllers to ensure that the control panel instantiation did not delay the loading of any widget. Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/services/data_manager.js')
-rw-r--r--addons/web/static/src/js/services/data_manager.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/addons/web/static/src/js/services/data_manager.js b/addons/web/static/src/js/services/data_manager.js
index 45374d4833b..12d7ce24f8d 100644
--- a/addons/web/static/src/js/services/data_manager.js
+++ b/addons/web/static/src/js/services/data_manager.js
@@ -99,26 +99,28 @@ return core.Class.extend({
},
model: model,
method: 'load_views',
- }).then(function (result) {
+ }).then(async result => {
// Freeze the fields dict as it will be shared between views and
// no one should edit it
utils.deepFreeze(result.fields);
// Insert views into the fields_views cache
- _.each(views_descr, function (view_descr) {
+ for (const view_descr of views_descr) {
var toolbar = options.toolbar && view_descr[1] !== 'search';
var fv_key = self._gen_key(model, view_descr[0], view_descr[1], toolbar, context);
var fvg = result.fields_views[view_descr[1]];
+ if (view_descr[1] === 'search') {
+ fvg.favoriteFilters = result.filters;
+ }
fvg.viewFields = fvg.fields;
fvg.fields = result.fields;
self._cache.fields_views[fv_key] = Promise.resolve(fvg);
- });
+ }
// Insert filters, if any, into the filters cache
if (result.filters) {
self._cache.filters[filters_key] = Promise.resolve(result.filters);
}
-
return result.fields_views;
}, this._invalidate.bind(this, this._cache.views, key));
}