From e844ba1040aa3ea52792324272e3a39a9df2ea6e Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Fri, 20 Dec 2013 13:39:25 +0100 Subject: [PATCH] [FIX] prevents a crash happening in some cases when the searchview does not initialize a groupbygroup instance before the method register_groupby in graph view used it (addon web_graph) bzr revid: ged@openerp.com-20131220123925-qycdvanm51nkc4uo --- addons/web_graph/static/src/js/graph.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 4eeaec194eb..b966a38e898 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -127,7 +127,8 @@ instance.web_graph.GraphView = instance.web.View.extend({ query = this.search_view.query; this.groupby_mode = 'manual'; - if (_.isEqual(this.search_view_groupby, this.graph_widget.pivot.rows.groupby)) { + if (_.isEqual(this.search_view_groupby, this.graph_widget.pivot.rows.groupby) || + (!_.has(this.search_view, '_s_groupby'))) { return; } var rows = _.map(this.graph_widget.pivot.rows.groupby, function (group) { @@ -340,6 +341,9 @@ instance.web_graph.Graph = instance.web.Widget.extend({ var field = header.root.groupby[header.path.length]; this.pivot.expand(id, field); } else { + if (!this.important_fields.length) { + return; + } var fields = _.map(this.important_fields, function (field) { return {id: field, value: self.fields[field].string}; });