summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/graph
diff options
context:
space:
mode:
authorJigar Patel <jat@openerp.com>2017-07-19 14:18:12 +0530
committerGéry Debongnie <ged@odoo.com>2017-07-19 10:50:21 +0200
commitb63e22f50ea8cce8deaa7dcc0d1c5649d2d2880b (patch)
tree97de8a98ea4e12f1882298343f01b00eb5e7b880 /addons/web/static/src/js/views/graph
parentefd158523438cebd96f9f2e7243873f222a97fea (diff)
[FIX] web: Groupby not working on Pivot and Graph view
The groupby property was wrongly set in some cases: if a graph/pivot view is defined as a groupby on field F, but there is another groupby key G in the context, it will take F instead of G (at initial load).
Diffstat (limited to 'addons/web/static/src/js/views/graph')
-rw-r--r--addons/web/static/src/js/views/graph/graph_model.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/addons/web/static/src/js/views/graph/graph_model.js b/addons/web/static/src/js/views/graph/graph_model.js
index 5948e07a54f..8a7f5da6d5d 100644
--- a/addons/web/static/src/js/views/graph/graph_model.js
+++ b/addons/web/static/src/js/views/graph/graph_model.js
@@ -60,12 +60,13 @@ return AbstractModel.extend({
this.modelName = params.modelName;
this.chart = {
data: [],
- groupedBy: params.groupBys,
+ groupedBy: params.groupedBy.length ? params.groupedBy : params.groupBys,
measure: params.measure,
mode: params.mode,
domain: params.domain,
context: params.context,
};
+ this.defaultGroupedBy = params.groupedBy;
return this._loadGraph();
},
/**
@@ -88,11 +89,7 @@ return AbstractModel.extend({
this.chart.domain = params.domain;
}
if ('groupBy' in params) {
- if (!params.groupBy.length) {
- this.chart.groupedBy = this.initialGroupBys;
- } else {
- this.chart.groupedBy = params.groupBy;
- }
+ this.chart.groupedBy = params.groupBy.length ? params.groupBy : this.defaultGroupedBy;
}
if ('measure' in params) {
this.chart.measure = params.measure;