summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js/graph_widget.js
diff options
context:
space:
mode:
authorkevin wang <kevin_327@163.com>2015-01-07 16:52:14 +0800
committerGéry Debongnie <ged@odoo.com>2015-01-09 14:40:53 +0100
commitd023c079ed86468436f25da613bf486a4a17d625 (patch)
treeaf6ef583c103b449e1cf4b6cc19d36862d55570c /addons/web_graph/static/src/js/graph_widget.js
parent010dd5a603063542a5ec64800535fdd946c516e2 (diff)
[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.
Diffstat (limited to 'addons/web_graph/static/src/js/graph_widget.js')
-rw-r--r--addons/web_graph/static/src/js/graph_widget.js10
1 files 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; }