diff options
| author | Gery Debongnie <ged@openerp.com> | 2013-11-28 09:45:51 +0100 |
|---|---|---|
| committer | Gery Debongnie <ged@openerp.com> | 2013-11-28 09:45:51 +0100 |
| commit | be00aca052de10bbcfcf82ab00bac7802059e331 (patch) | |
| tree | 7a3045492492ee17d0a0a2e8e6417ba1c9326ea2 /addons/web_graph/static | |
| parent | 51e4b240f841a76f562832cc84fcd0c6cd553721 (diff) | |
[REF] removes all references to measure label in pivot table (addon web_graph)
bzr revid: ged@openerp.com-20131128084551-19hc23fmw3gvtoc9
Diffstat (limited to 'addons/web_graph/static')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 17 | ||||
| -rw-r--r-- | addons/web_graph/static/src/js/pivot.js | 14 |
2 files changed, 19 insertions, 12 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 1bcb0fd98d3..119d0b12e16 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -34,7 +34,8 @@ instance.web_graph.GraphView = instance.web.View.extend({ 'click .graph_measure_selection li' : function (event) { event.preventDefault(); var measure = event.target.attributes['data-choice'].nodeValue; - this.pivot_table.set_measure(measure) + this.measure = (measure === '__count') ? null : measure; + this.pivot_table.set_measure(this.measure) .then(this.proxy('display_data')); }, @@ -99,6 +100,7 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.pivot_table = null; this.heat_map_mode = false; this.mode = 'pivot'; + this.measure = null; this.measure_list = []; this.important_fields = []; }, @@ -133,6 +135,9 @@ instance.web_graph.GraphView = instance.web.View.extend({ } } }); + if (this.measure_list.length > 0) { + this.measure = this.measure_list[0]; + } // get the most important fields (of the model) by looking at the // groupby filters defined in the search view @@ -161,12 +166,12 @@ instance.web_graph.GraphView = instance.web.View.extend({ return $.when(important_fields_def, field_descr_def) .then(function () { + self.fields = fields; self.data = { model: model, domain: domain, fields: fields, - measure: self.measure_list[0], - measure_label: fields[self.measure_list[0]].string, + measure: self.measure, col_groupby: [], row_groupby: row_groupby, groups: [], @@ -261,7 +266,13 @@ instance.web_graph.GraphView = instance.web.View.extend({ this.$('.field-selection').next('.dropdown-menu').toggle(); }, + measure_label: function () { + return (this.measure) ? this.fields[this.measure].string : 'Quantity'; + }, + draw_table: function () { + this.pivot_table.rows.main.title = 'Total'; + this.pivot_table.cols.main.title = this.measure_label(); this.draw_top_headers(); _.each(this.pivot_table.rows.headers, this.proxy('draw_row')); }, diff --git a/addons/web_graph/static/src/js/pivot.js b/addons/web_graph/static/src/js/pivot.js index d6ae2168bbf..40ee4f0acda 100644 --- a/addons/web_graph/static/src/js/pivot.js +++ b/addons/web_graph/static/src/js/pivot.js @@ -12,7 +12,6 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({ this.model = options.model; this.domain = options.domain; this.measure = options.measure; - this.measure_label = options.measure_label; this.total = 0; this.id_seed = 0; this.no_data = true; @@ -58,7 +57,7 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({ }, set_measure: function (measure) { - this.measure = (measure === '__count') ? null : measure; + this.measure = measure; return this.update_values(); }, @@ -143,9 +142,6 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({ var temp = this.rows; this.rows = this.cols; this.cols = temp; - - this.rows.main.title = 'Total'; - this.cols.main.title = this.measure_label; }, fold_rows: function () { @@ -173,8 +169,8 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({ self.rows.main = self.rows.headers[0]; self.cols.main = self.cols.headers[0]; self.total = self.rows.main.total; - self.rows.main.title = 'Total'; - self.cols.main.title = self.measure_label; + self.rows.main.title = ''; + self.cols.main.title = ''; _.each(self.rows.headers, function (row) { row.root = self.rows; row.is_expanded = (row.children.length > 0); @@ -269,8 +265,8 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend({ col.root = self.cols; }); self.cells = result.cells; - self.rows.main.title = 'Total'; - self.cols.main.title = self.measure_label; + self.rows.main.title = ''; + self.cols.main.title = ''; }); }, |
