summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js/pivot_table.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2014-08-13 11:12:20 +0200
committerChristophe Simonis <chs@odoo.com>2014-08-13 11:12:20 +0200
commitff0ab6426a116bb504188764f76b63e4387279b7 (patch)
tree7a2899962b5f822b693c0fbdb745456b15a621d6 /addons/web_graph/static/src/js/pivot_table.js
parentb49755b54554c1f85a53b4283a3b513400b82096 (diff)
[FIX] web_graph : display the corresponding label for selection fields in graph view
Diffstat (limited to 'addons/web_graph/static/src/js/pivot_table.js')
-rw-r--r--addons/web_graph/static/src/js/pivot_table.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/addons/web_graph/static/src/js/pivot_table.js b/addons/web_graph/static/src/js/pivot_table.js
index 086e7205990..b842b00f00d 100644
--- a/addons/web_graph/static/src/js/pivot_table.js
+++ b/addons/web_graph/static/src/js/pivot_table.js
@@ -423,14 +423,15 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({
attrs.value = [attrs.value];
}
attrs.value = _.range(grouped_on.length).map(function (i) {
+ var grp = grouped_on[i],
+ field = self.fields[grp];
if (attrs.value[i] === false) {
return _t('Undefined');
} else if (attrs.value[i] instanceof Array) {
return attrs.value[i][1];
- }else if (grouped_on && self.fields[grouped_on].type === 'selection'){
- var selection = self.fields[grouped_on].selection;
- var value_lookup = _.where(selection, {0:attrs.value[i]});
- return value_lookup ? value_lookup[0][1] : _t('Undefined');
+ } else if (field && field.type === 'selection') {
+ var selected = _.where(field.selection, {0: attrs.value[i]})[0];
+ return selected ? selected[1] : attrs.value[i];
}
return attrs.value[i];
});