diff options
| author | Adrien Dieudonne <adr@odoo.com> | 2018-08-13 10:23:19 +0200 |
|---|---|---|
| committer | Mathieu Duckerts-Antoine <dam@odoo.com> | 2018-08-14 12:37:25 +0200 |
| commit | d4461cd4340274fdd284ecfeb451de7760ce40e2 (patch) | |
| tree | eb4321d0c9940ab8aefe6be6e9a87f1c20b4ead0 /addons/web/static/src/js/views/pivot/pivot_controller.js | |
| parent | 333ac27cd5c23e3e1a4f7d78828f28a2c844f8f4 (diff) | |
[IMP] web: comparisons in pivot view
A previous commit [333ac27] has introduced a new widget TimeRangeMenu
that allows to create two sets of data to compare relatively
to a given date or datetime field.
This commit allows the pivot view to render appropriately two
sets of data in a unique table. In comparison mode, instead of
one column, three columns are created. One contains the
aggregates from the data of interest, one contains the
aggregates from the comparison data, and the last one contains
information on the data variation (expressed in percentage).
Task Id: 1835644
Diffstat (limited to 'addons/web/static/src/js/views/pivot/pivot_controller.js')
| -rw-r--r-- | addons/web/static/src/js/views/pivot/pivot_controller.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/pivot/pivot_controller.js b/addons/web/static/src/js/views/pivot/pivot_controller.js index 94f4f3c1876..5aaeec9629c 100644 --- a/addons/web/static/src/js/views/pivot/pivot_controller.js +++ b/addons/web/static/src/js/views/pivot/pivot_controller.js @@ -238,16 +238,23 @@ var PivotController = AbstractController.extend({ * @param {MouseEvent} event */ _onCellClick: function (event) { - var $target = $(event.target); + var $target = $(event.currentTarget); if ($target.hasClass('o_pivot_header_cell_closed') || $target.hasClass('o_pivot_header_cell_opened') || $target.hasClass('o_empty') || + $target.data('type') === 'variation' || !this.enableLinking) { return; } var state = this.model.get(this.handle); - var colDomain = this.model.getHeader($target.data('col_id')).domain; - var rowDomain = this.model.getHeader($target.data('id')).domain; + var colDomain, rowDomain; + if ($target.data('type') === 'comparisonData') { + colDomain = this.model.getHeader($target.data('col_id')).comparisonDomain || []; + rowDomain = this.model.getHeader($target.data('id')).comparisonDomain || []; + } else { + colDomain = this.model.getHeader($target.data('col_id')).domain || []; + rowDomain = this.model.getHeader($target.data('id')).domain || []; + } var context = _.omit(state.context, function (val, key) { return key === 'group_by' || _.str.startsWith(key, 'search_default_'); }); |
