summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src/js/graph_widget.js
diff options
context:
space:
mode:
authorqdc <qdc@openerp.com>2014-08-21 09:03:12 +0200
committerThibault Delavallée <tde@openerp.com>2014-08-21 11:09:49 +0200
commit8307a5f6ed54bd69ada4250e0c3170552bf210de (patch)
tree91aa2fd5ad1c8a99d885292e0acf0bbb740dbefc /addons/web_graph/static/src/js/graph_widget.js
parent4c6dcd7fcb9a0463003c3820eb9a35dfb7af14b3 (diff)
[IMP] Graph views: show always measure + filters record measures in context
Diffstat (limited to 'addons/web_graph/static/src/js/graph_widget.js')
-rw-r--r--addons/web_graph/static/src/js/graph_widget.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/addons/web_graph/static/src/js/graph_widget.js b/addons/web_graph/static/src/js/graph_widget.js
index db33e567b42..483c2199747 100644
--- a/addons/web_graph/static/src/js/graph_widget.js
+++ b/addons/web_graph/static/src/js/graph_widget.js
@@ -153,41 +153,49 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
// ----------------------------------------------------------------------
// Configuration methods
// ----------------------------------------------------------------------
- set: function (domain, row_groupby, col_groupby) {
+ set: function (domain, row_groupby, col_groupby, measures_groupby) {
if (!this.pivot) {
this.pivot_options.domain = domain;
this.pivot_options.row_groupby = row_groupby;
this.pivot_options.col_groupby = col_groupby;
+ this.pivot_options.measures_groupby = measures_groupby;
return;
}
var row_gbs = this.create_field_values(row_groupby),
col_gbs = this.create_field_values(col_groupby),
+ measures_gbs = this.create_field_values(measures_groupby),
dom_changed = !_.isEqual(this.pivot.domain, domain),
row_gb_changed = !_.isEqual(row_gbs, this.pivot.rows.groupby),
col_gb_changed = !_.isEqual(col_gbs, this.pivot.cols.groupby),
+ measures_gb_changed = !_.isEqual(measures_gbs, this.pivot.measures),
row_reduced = is_strict_beginning_of(row_gbs, this.pivot.rows.groupby),
- col_reduced = is_strict_beginning_of(col_gbs, this.pivot.cols.groupby);
+ col_reduced = is_strict_beginning_of(col_gbs, this.pivot.cols.groupby),
+ measures_reduced = is_strict_beginning_of(measures_gbs, this.pivot.measures);
- if (!dom_changed && row_reduced && !col_gb_changed) {
+ if (!dom_changed && row_reduced && !col_gb_changed && !measures_gb_changed) {
this.pivot.fold_with_depth(this.pivot.rows, row_gbs.length);
this.display_data();
return;
}
- if (!dom_changed && col_reduced && !row_gb_changed) {
+ if (!dom_changed && col_reduced && !row_gb_changed && !measures_gb_changed) {
this.pivot.fold_with_depth(this.pivot.cols, col_gbs.length);
this.display_data();
return;
}
- if (!dom_changed && col_reduced && row_reduced) {
+ if (!dom_changed && col_reduced && row_reduced && !measures_gb_changed) {
this.pivot.fold_with_depth(this.pivot.rows, row_gbs.length);
this.pivot.fold_with_depth(this.pivot.cols, col_gbs.length);
this.display_data();
return;
}
- if (dom_changed || row_gb_changed || col_gb_changed) {
- this.pivot.set(domain, row_gbs, col_gbs).then(this.proxy('display_data'));
+ if (dom_changed || row_gb_changed || col_gb_changed || measures_gb_changed) {
+ this.pivot.set(domain, row_gbs, col_gbs, measures_gbs).then(this.proxy('display_data'));
+ }
+
+ if (measures_gb_changed) {
+ this.put_measure_checkmarks();
}
},
@@ -235,6 +243,10 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
return _.pluck(this.pivot.cols.groupby, 'field');
},
+ get_current_measures: function () {
+ return _.pluck(this.pivot.measures, 'field');
+ },
+
// ----------------------------------------------------------------------
// UI code
// ----------------------------------------------------------------------
@@ -627,7 +639,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
},
draw_measure_row: function (measure_row) {
- if (this.pivot.measures.length === 1) { return; }
var $row = $('<tr>').append('<th>');
_.each(measure_row, function (cell) {
var $cell = $('<th>').addClass('measure_row').text(cell.text);