From 1882e656088bb53884f6faa16bec412d7d306ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 11 Oct 2020 16:14:09 +0200 Subject: [PATCH] Clear view_tree_state cache only when set is called There is no need to clear the cache if we do not store on the server the modifications. issue9656 review296371002 --- src/screen.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/screen.js b/src/screen.js index 611c13fa1a..c2a709dd4d 100644 --- a/src/screen.js +++ b/src/screen.js @@ -2035,6 +2035,10 @@ store = (store === undefined) ? true : store; var i, len, view, widgets, wi, wlen; var parent_ = this.group.parent ? this.group.parent.id : null; + var clear_cache = function() { + Sao.Session.current_session.cache.clear( + 'model.ir.ui.view_tree_state.get'); + }; for (i = 0, len = this.views.length; i < len; i++) { view = this.views[i]; if (view.view_type == 'form') { @@ -2074,15 +2078,13 @@ this.get_tree_domain(parent_), view.children_field, JSON.stringify(paths), - JSON.stringify(selected_paths)], {}); + JSON.stringify(selected_paths)], {}) + .then(clear_cache); prms.push(prm); } } } - return jQuery.when.apply(jQuery, prms).then(function() { - Sao.Session.current_session.cache.clear( - 'model.ir.ui.view_tree_state.get'); - }); + return jQuery.when.apply(jQuery, prms); }, get_tree_domain: function(parent_) { var domain;