[IMP] allows the selection of multiple measures in graph view (addon web_graph)

bzr revid: ged@openerp.com-20140103144418-7mstnfwah6v6jkkx
This commit is contained in:
Gery Debongnie 2014-01-03 15:44:18 +01:00
parent 64775d4098
commit 47762dfca2
2 changed files with 14 additions and 2 deletions

View File

@ -344,7 +344,7 @@ instance.web_graph.Graph = instance.web.Widget.extend({
measure_selection: function (event) {
event.preventDefault();
var measure = event.target.attributes['data-choice'].nodeValue;
this.pivot.config({measures:[measure]});
this.pivot.config({toggle_measure:measure});
},
option_selection: function (event) {
@ -421,7 +421,11 @@ instance.web_graph.Graph = instance.web.Widget.extend({
******************************************************************************/
draw_table: function () {
this.pivot.rows.main.title = 'Total';
this.pivot.cols.main.title = this.title;
if (this.pivot.measures.length == 1) {
this.pivot.cols.main.title = this.measure_label(this.pivot.measures[0]);
} else {
this.pivot.cols.main.title = this.title;
}
this.draw_top_headers();
_.each(this.pivot.rows.headers, this.proxy('draw_row'));
},

View File

@ -51,6 +51,14 @@ openerp.web_graph.PivotTable = openerp.web.Class.extend(openerp.EventDispatcherM
this.measures = options.measures;
changed = true;
}
if (options.toggle_measure) {
if (_.contains(this.measures, options.toggle_measure)) {
this.measures = _.without(this.measures, options.toggle_measure);
} else {
this.measures.push(options.toggle_measure);
}
changed = true;
}
if (!_.isEqual(options.col_groupby, this.cols.groupby)) {
this.cols.groupby = options.col_groupby;
changed = true;