Merge lp:~openerp-dev/openerp-web/trunk-graph-export-xls-float-mat into lp:openerp-web

Proposed by Martin Trigaux (OpenERP)
Status: Merged
Merged at revision: 3965
Proposed branch: lp:~openerp-dev/openerp-web/trunk-graph-export-xls-float-mat
Merge into: lp:openerp-web
Diff against target: 62 lines (+8/-8)
1 file modified
addons/web_graph/static/src/js/graph_widget.js (+8/-8)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-graph-export-xls-float-mat
Reviewer Review Type Date Requested Status
Ferdinand (community) Needs Fixing
Géry Debongnie Pending
Review via email: mp+214186@code.launchpad.net

Description of the change

Adding raw format capability to web_grap

To post a comment you must log in.
Revision history for this message
Ferdinand (office-chricar) wrote :

see last comment in bug report

review: Needs Fixing
3966. By Martin Trigaux (OpenERP)

[FIX] skip undefined and keep formating as empty string

Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Fixed for reported case and merged in trunk

revno: 3965 [merge]
revision-id: <email address hidden>

Revision history for this message
Ferdinand (office-chricar) wrote :

thanks

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web_graph/static/src/js/graph_widget.js'
2--- addons/web_graph/static/src/js/graph_widget.js 2014-03-11 13:22:00 +0000
3+++ addons/web_graph/static/src/js/graph_widget.js 2014-04-04 15:18:02 +0000
4@@ -381,11 +381,11 @@
5 // Convert Pivot data structure into table structure :
6 // compute rows, cols, colors, cell width, cell height, ...
7 // ----------------------------------------------------------------------
8- build_table: function() {
9+ build_table: function(raw) {
10 return {
11 headers: this.build_headers(),
12 measure_row: this.build_measure_row(),
13- rows: this.build_rows(),
14+ rows: this.build_rows(raw),
15 nbr_measures: this.pivot.measures.length,
16 title: this.title,
17 };
18@@ -435,8 +435,8 @@
19 return result;
20 },
21
22- make_cell: function (row, col, value, index) {
23- var formatted_value = openerp.web.format_value(value, {type:this.pivot.measures[index].type}),
24+ make_cell: function (row, col, value, index, raw) {
25+ var formatted_value = raw && !_.isUndefined(value) ? value : openerp.web.format_value(value, {type:this.pivot.measures[index].type}),
26 cell = {value:formatted_value};
27
28 if (this.heatmap_mode === 'none') { return cell; }
29@@ -450,7 +450,7 @@
30 return cell;
31 },
32
33- build_rows: function () {
34+ build_rows: function (raw) {
35 var self = this,
36 pivot = this.pivot,
37 m, cell;
38@@ -460,13 +460,13 @@
39 _.each(pivot.get_cols_leaves(), function (col) {
40 var values = pivot.get_values(row.id,col.id);
41 for (m = 0; m < pivot.measures.length; m++) {
42- cells.push(self.make_cell(row,col,values[m], m));
43+ cells.push(self.make_cell(row,col,values[m], m, raw));
44 }
45 });
46 if (pivot.get_cols_leaves().length > 1) {
47 var totals = pivot.get_total(row);
48 for (m = 0; m < pivot.measures.length; m++) {
49- cell = self.make_cell(row, pivot.main_col(), totals[m], m);
50+ cell = self.make_cell(row, pivot.main_col(), totals[m], m, raw);
51 cell.is_bold = 'true';
52 cells.push(cell);
53 }
54@@ -743,7 +743,7 @@
55 openerp.web.blockUI();
56 this.session.get_file({
57 url: '/web_graph/export_xls',
58- data: {data: JSON.stringify(this.build_table())},
59+ data: {data: JSON.stringify(this.build_table(true))},
60 complete: openerp.web.unblockUI,
61 error: c.rpc_error.bind(c)
62 });