From ccaced9292174e468e4fa88d1bbb704002d07eb1 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Mon, 27 Nov 2017 15:02:40 +0100 Subject: [PATCH] [FIX] web: display selection label in graph When grouping a graph view by a selection field, the labels on x axis were the selection values themselves (not their corresponding label). This issue was only present if there was only one group by field. In this case, the attribute `grouped_on` is not an array but a string containing the field name. This case wasn't correctly handled. Note that this issue is not present in the new views (from saas-16). Closes #19790 --- addons/web/static/src/js/views/graph_widget.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/graph_widget.js b/addons/web/static/src/js/views/graph_widget.js index 8e6a574a35d..d1452fed2b1 100644 --- a/addons/web/static/src/js/views/graph_widget.js +++ b/addons/web/static/src/js/views/graph_widget.js @@ -66,7 +66,8 @@ return Widget.extend({ values = []; if (this.groupbys.length === 1) data_pt.value = [data_pt.value]; for (j = 0; j < data_pt.value.length; j++) { - values[j] = this.sanitize_value(data_pt.value[j], data_pt.grouped_on[j]); + var field = _.isArray(data_pt.grouped_on) ? data_pt.grouped_on[j] : data_pt.grouped_on; + values[j] = this.sanitize_value(data_pt.value[j], field); } value = is_count ? data_pt.length : data_pt.aggregates[this.measure]; this.data.push({