[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
This commit is contained in:
Gery Debongnie 2014-02-10 12:23:13 +01:00
parent ff89abba85
commit 9eda870d2b
1 changed files with 13 additions and 0 deletions

View File

@ -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'});