summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorMathieu Duckerts-Antoine <dam@odoo.com>2018-10-02 11:21:30 +0200
committerMathieu Duckerts-Antoine <dam@odoo.com>2018-10-02 13:04:34 +0200
commit64d7da419885301fa2c1b26bf3cde286052cefba (patch)
tree112a8054cfe2f0c2e7cd565705ce1a874b7e870e /addons/web/static/src
parent16469ec95be444eda2ace032a938e4bc9d960236 (diff)
[FIX] web: fix update problems in graph view
The graph view was not updated correctly with respect to time range menu data. We fix that problem in this commit.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/graph/graph_model.js11
-rw-r--r--addons/web/static/src/js/views/graph/graph_renderer.js10
2 files changed, 21 insertions, 0 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 fa9a7180e06..adefe1e8953 100644
--- a/addons/web/static/src/js/views/graph/graph_model.js
+++ b/addons/web/static/src/js/views/graph/graph_model.js
@@ -101,6 +101,17 @@ return AbstractModel.extend({
this.chart.groupedBy = params.context.graph_groupbys || this.chart.groupedBy;
this.chart.measure = params.context.graph_measure || this.chart.measure;
this.chart.mode = params.context.graph_mode || this.chart.mode;
+ var timeRangeMenuData = params.context.timeRangeMenuData;
+ if (timeRangeMenuData) {
+ this.chart.timeRange = timeRangeMenuData.timeRange || [];
+ this.chart.comparisonTimeRange = timeRangeMenuData.comparisonTimeRange || [];
+ this.chart.compare = this.chart.comparisonTimeRange.length > 0;
+ } else {
+ this.chart.timeRange = [];
+ this.chart.comparisonTimeRange = [];
+ this.chart.compare = false;
+ this.chart = _.omit(this.chart, 'comparisonData');
+ }
}
if ('domain' in params) {
this.chart.domain = params.domain;
diff --git a/addons/web/static/src/js/views/graph/graph_renderer.js b/addons/web/static/src/js/views/graph/graph_renderer.js
index c2bb79c491f..470d064ef68 100644
--- a/addons/web/static/src/js/views/graph/graph_renderer.js
+++ b/addons/web/static/src/js/views/graph/graph_renderer.js
@@ -68,6 +68,16 @@ return AbstractRenderer.extend({
this._super.apply(this, arguments);
this.isInDOM = false;
},
+ /**
+ * @override
+ * @param {Object} state
+ * @param {Object} params
+ */
+ updateState: function (state, params) {
+ this.isComparison = !!state.comparisonData;
+ this.stacked = this.isComparison ? false : params.stacked;
+ return this._super.apply(this, arguments);
+ },
//--------------------------------------------------------------------------
// Private