diff options
| author | Mathieu Duckerts-Antoine <dam@odoo.com> | 2020-05-25 18:11:02 +0000 |
|---|---|---|
| committer | Mathieu Duckerts-Antoine <dam@odoo.com> | 2020-06-04 19:32:42 +0000 |
| commit | be5a51a345b8986da0e19627260f64f984e11ae9 (patch) | |
| tree | 4a0b1e5b0bfdad3124718ccf8e67164b5bbe07dd /addons/web/static/src/js/views/graph | |
| parent | 884ef9f7ee345ab1e940dbf88f4432b7e10f36e3 (diff) | |
[IMP] web: Comparison menu
This commit replaces the "time range menu" in the control panel by a new
component: the "comparison menu".
Its purpose is roughly the same: compare a period of data in a reporting
view with the previous period or the previous year.
Its implementation is a bit simpler: it will only appear if at least one
date filter is selected in the search view, and will suggest to compare
each selected date option with the previous period or the previous year.
Task ID: 2245719
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/graph')
| -rw-r--r-- | addons/web/static/src/js/views/graph/graph_model.js | 11 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/graph/graph_view.js | 2 |
2 files changed, 6 insertions, 7 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 6ee4d06651e..ccaa008f3f7 100644 --- a/addons/web/static/src/js/views/graph/graph_model.js +++ b/addons/web/static/src/js/views/graph/graph_model.js @@ -150,12 +150,11 @@ return AbstractModel.extend({ const { range, rangeDescription, comparisonRange, comparisonRangeDescription, fieldName } = this.chart.timeRanges; if (range) { - this.chart.domains = [this.chart.domain.concat(range)]; - this.chart.origins = [rangeDescription]; - if (comparisonRange) { - this.chart.domains.push(this.chart.domain.concat(comparisonRange)); - this.chart.origins.push(comparisonRangeDescription); - } + this.chart.domains = [ + this.chart.domain.concat(range), + this.chart.domain.concat(comparisonRange), + ]; + this.chart.origins = [rangeDescription, comparisonRangeDescription]; const groupBys = this.chart.processedGroupBy.map(function (gb) { return gb.split(":")[0]; }); diff --git a/addons/web/static/src/js/views/graph/graph_view.js b/addons/web/static/src/js/views/graph/graph_view.js index dbfd9f0e211..5293409cb8b 100644 --- a/addons/web/static/src/js/views/graph/graph_view.js +++ b/addons/web/static/src/js/views/graph/graph_view.js @@ -31,7 +31,7 @@ var GraphView = AbstractView.extend({ Renderer: GraphRenderer, }), viewType: 'graph', - searchMenuTypes: ['filter', 'groupBy', 'timeRange', 'favorite'], + searchMenuTypes: ['filter', 'groupBy', 'comparison', 'favorite'], /** * @override |
