changeset 95d9965fbd89 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=95d9965fbd89
description:
        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
diffstat:

 src/screen.js |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r a90f2be79a41 -r 95d9965fbd89 src/screen.js
--- a/src/screen.js     Sun Oct 11 16:10:38 2020 +0200
+++ b/src/screen.js     Sun Oct 11 16:14:09 2020 +0200
@@ -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;

Reply via email to