From 9eda870d2b8bad1d2c480a9a54eb7264ce4df183 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Mon, 10 Feb 2014 12:23:13 +0100 Subject: [PATCH] [FIX] fixes a bug caused by two consecutive calls to do_search, with incomplete informations in the first call. These calls then triggered useless queries and caused an incorrect (but brief) display of partial information in graph view (addon web_graph) bzr revid: ged@openerp.com-20140210112313-z9elwhmjil41jcd2 --- addons/web_graph/static/src/js/graph_view.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/web_graph/static/src/js/graph_view.js b/addons/web_graph/static/src/js/graph_view.js index b39ac105ee4..33b99b88bcf 100644 --- a/addons/web_graph/static/src/js/graph_view.js +++ b/addons/web_graph/static/src/js/graph_view.js @@ -77,6 +77,11 @@ instance.web_graph.GraphView = instance.web.View.extend({ }, do_search: function (domain, context, group_by) { + if (this.ignore_do_search) { + this.ignore_do_search = false; + return; + } + var self = this, col_group_by = this.extract_groupby('col_group_by', context) || []; @@ -131,6 +136,14 @@ instance.web_graph.GraphView = instance.web.View.extend({ if (!_.has(this.search_view, '_s_groupby')) { return; } + if (row_groupby.length && col_groupby.length) { + // when two changes to the search view will be done, the method do_search + // will be called twice, once with the correct groupby and incorrect col_groupby, + // and once with correct informations. This flag is necessary to prevent the + // incorrect informations to propagate and trigger useless queries + this.ignore_do_search = true; + } + // add row groupbys var row_facet = this.make_row_groupby_facets(row_groupby), row_search_facet = query.findWhere({category:'GroupBy'});