From 5b94799c820fb1d2ac530fd67f29cfd70722cb5b Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Tue, 23 Aug 2016 13:49:15 +0200 Subject: [IMP] web: allow to clear the cache in data manager Sometimes, we need better control on the cache. For example, if a view or an action has been changed, it is required to make sure that the correct data is loaded. --- addons/web/static/src/js/framework/data_manager.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'addons/web/static/src/js/framework/data_manager.js') diff --git a/addons/web/static/src/js/framework/data_manager.js b/addons/web/static/src/js/framework/data_manager.js index 29d6d585f6a..f2aa602ab41 100644 --- a/addons/web/static/src/js/framework/data_manager.js +++ b/addons/web/static/src/js/framework/data_manager.js @@ -9,6 +9,10 @@ var utils = require('web.utils'); return core.Class.extend({ init: function () { this.Filters = new Model('ir.filters'); + this._init_cache(); + }, + + _init_cache: function () { this._cache = { actions: {}, fields_views: {}, @@ -18,6 +22,14 @@ return core.Class.extend({ }; }, + /** + * Invalidates the whole cache + * Suggestion: could be refined to invalidate some part of the cache + */ + invalidate: function () { + this._init_cache(); + }, + /** * Loads an action from its id or xmlid. * -- cgit v1.2.3