From d023c079ed86468436f25da613bf486a4a17d625 Mon Sep 17 00:00:00 2001 From: kevin wang Date: Wed, 7 Jan 2015 16:52:14 +0800 Subject: [PATCH] [FIX] web_graph: format pivot cells with correct precision fields received by the fields_get call sometimes have a digit precision. This commit makes sure that it is used when formatting the cells to be displayed. --- addons/web_graph/static/src/js/graph_widget.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/addons/web_graph/static/src/js/graph_widget.js b/addons/web_graph/static/src/js/graph_widget.js index 13dc558c287..ca031039263 100644 --- a/addons/web_graph/static/src/js/graph_widget.js +++ b/addons/web_graph/static/src/js/graph_widget.js @@ -227,7 +227,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ var field = (_.contains(f, ':')) ? f.split(':')[0] : f, groupby_field = _.findWhere(this.groupby_fields, {field:field}), string = groupby_field ? groupby_field.string : this.fields[field].string, - result = {field: f, string: string, type: this.fields[field].type }; + result = {field: f, string: string, type: this.fields[field].type, digits: this.fields[field].digits }; if (groupby_field) { result.filter = groupby_field.filter; @@ -271,11 +271,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ event.preventDefault(); event.stopPropagation(); var measure_field = event.target.getAttribute('data-choice'); - var measure = { - field: measure_field, - type: this.fields[measure_field].type, - string: this.fields[measure_field].string - }; + var measure = this.create_field_value(measure_field); this.pivot.toggle_measure(measure).then(this.proxy('display_data')); this.put_measure_checkmarks(); @@ -496,7 +492,7 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({ }, make_cell: function (row, col, value, index, raw) { - var formatted_value = raw && !_.isUndefined(value) ? value : openerp.web.format_value(value, {type:this.pivot.measures[index].type}), + var formatted_value = raw && !_.isUndefined(value) ? value : openerp.web.format_value(value, this.pivot.measures[index]), cell = {value:formatted_value}; if (this.heatmap_mode === 'none') { return cell; }