diff options
| author | mcm-odoo <mcm@odoo.com> | 2020-01-15 13:03:29 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-01-21 10:22:50 +0000 |
| commit | 01e3a5996f9fab841be270b84f0877d0b8b9fc37 (patch) | |
| tree | bb2de3a9a36c1f0d50c312852fb654cab96b1b5c /addons/web/static/src/js/views/pivot/pivot_controller.js | |
| parent | 083ba2a811504671e6ceece6e2d5f14fe43e7ddc (diff) | |
[REF] web: pivot: use owl_compatibility tools
This commit changes ControllerAdapter to a mixin that inherits
WidgetAdapterMixin and RendererWrapper now extends ComponentWrapper.
This commit also changes PivotController base class/mixin and uses
the Odoo legacy custom_events because of the adapter.
closes odoo/odoo#43256
Related: odoo/enterprise#7744
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
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 | 27 |
1 files changed, 14 insertions, 13 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 606367d4d3a..e1c33a53fec 100644 --- a/addons/web/static/src/js/views/pivot/pivot_controller.js +++ b/addons/web/static/src/js/views/pivot/pivot_controller.js @@ -12,7 +12,7 @@ odoo.define('web.PivotController', function (require) { * view. */ - const ControllerAdapter = require('web.ControllerAdapter'); + const AbstractController = require('web.AbstractController'); const core = require('web.core'); const framework = require('web.framework'); const session = require('web.session'); @@ -20,14 +20,15 @@ odoo.define('web.PivotController', function (require) { const _t = core._t; const QWeb = core.qweb; - const PivotController = ControllerAdapter.extend({ - events: Object.assign({}, ControllerAdapter.prototype.events, { + const PivotController = AbstractController.extend({ + custom_events: Object.assign({}, AbstractController.prototype.custom_events, { closed_header_click: '_onClosedHeaderClicked', open_view: '_onOpenView', opened_header_click: '_onOpenedHeaderClicked', sort_rows: '_onSortRows', groupby_menu_selection: '_onGroupByMenuSelection', }), + /** * @override * @param parent @@ -206,7 +207,7 @@ odoo.define('web.PivotController', function (require) { * @private * */ _onOpenedHeaderClicked: function (ev) { - this.model.closeGroup(ev.detail.cell.groupId, ev.detail.type); + this.model.closeGroup(ev.data.cell.groupId, ev.data.type); this.update({}, { reload: false }); }, /** @@ -214,9 +215,9 @@ odoo.define('web.PivotController', function (require) { * @private * */ _onClosedHeaderClicked: async function (ev) { - const cell = ev.detail.cell; + const cell = ev.data.cell; const groupId = cell.groupId; - const type = ev.detail.type; + const type = ev.data.type; const group = { rowValues: groupId[0], @@ -245,8 +246,8 @@ odoo.define('web.PivotController', function (require) { _onGroupByMenuSelection: async function (ev) { ev.stopPropagation(); - let groupBy = ev.detail.field.name; - const interval = ev.detail.interval; + let groupBy = ev.data.field.name; + const interval = ev.data.interval; if (interval) { groupBy = groupBy + ':' + interval; } @@ -260,7 +261,7 @@ odoo.define('web.PivotController', function (require) { */ _onOpenView: function (ev) { ev.stopPropagation(); - const cell = ev.detail; + const cell = ev.data; if (cell.value === undefined || this.initialState.disableLinking) { return; } @@ -297,10 +298,10 @@ odoo.define('web.PivotController', function (require) { */ _onSortRows: function (ev) { this.model.sortRows({ - groupId: ev.detail.groupId, - measure: ev.detail.measure, - order: (ev.detail.order || 'desc') === 'asc' ? 'desc' : 'asc', - originIndexes: ev.detail.originIndexes, + groupId: ev.data.groupId, + measure: ev.data.measure, + order: (ev.data.order || 'desc') === 'asc' ? 'desc' : 'asc', + originIndexes: ev.data.originIndexes, }); this.update({}, { reload: false }); }, |
