From 7fc2afc5162124e213af84327b87cdc97ec9dec0 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Thu, 19 Dec 2013 13:54:22 +0100 Subject: [PATCH] [FIX] properly handles the situation where a user selected twice the same field in the search view groupbys (it simply added the field twice to groupbys instead of removing it (addon web_graph) bzr revid: ged@openerp.com-20131219125422-n2rpzbekyg7e0eyh --- addons/web_graph/static/src/js/graph.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 336be536346..a473e4df042 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -22,6 +22,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.dataset = dataset; this.model = new instance.web.Model(dataset.model, {group_by_no_leaf: true}); this.search_view = parent.searchview; + this.search_view_groupby = []; this.groupby_mode = 'default'; // 'default' or 'manual' this.default_row_groupby = []; this.default_col_groupby = []; @@ -76,6 +77,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ col_groupby = context.col_group_by || [], options = {domain:domain}; + this.search_view_groupby = group_by; if (group_by.length || col_groupby.length) { this.groupby_mode = 'manual'; } @@ -106,8 +108,11 @@ instance.web_graph.GraphView = instance.web.View.extend({ register_groupby: function() { var self = this, query = this.search_view.query; - this.groupby_mode = 'manual'; + this.groupby_mode = 'manual'; + if (_.isEqual(this.search_view_groupby, this.graph_widget.pivot.rows.groupby)) { + return; + } var rows = _.map(this.graph_widget.pivot.rows.groupby, function (group) { return make_facet('GroupBy', group); });