diff options
| author | Aaron Bohy <aab@odoo.com> | 2019-02-22 14:06:48 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-02-26 08:28:17 +0000 |
| commit | a76a958ca8479c3ea0c480bac730f7bfd62ce1d5 (patch) | |
| tree | fc41992f77915fc0c07a4365cc9c236ea4dd339d /addons | |
| parent | 397f2e6c50640ed74bdd5174824768bcda0d9581 (diff) | |
[FIX] board: clicking on a pivot cell in dashboard
Before this rev., it crashed when the user clicked on a pivot cell
in the dashboard, whereas it should have performed a do_action to
open the records in a list view.
This was due to a leftover event handler (with the handler function
being actually removed) in commit 38dc5c18b.
Issue reported on the saas-12.1 migration pad.
closes odoo/odoo#31367
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/board/static/src/js/board_view.js | 1 | ||||
| -rw-r--r-- | addons/board/static/tests/dashboard_tests.js | 47 |
2 files changed, 47 insertions, 1 deletions
diff --git a/addons/board/static/src/js/board_view.js b/addons/board/static/src/js/board_view.js index da8384f940f..4c1d989f54b 100644 --- a/addons/board/static/src/js/board_view.js +++ b/addons/board/static/src/js/board_view.js @@ -119,7 +119,6 @@ var BoardController = FormController.extend({ var BoardRenderer = FormRenderer.extend({ custom_events: _.extend({}, FormRenderer.prototype.custom_events, { - do_action: '_onDoAction', update_filters: '_onUpdateFilters', switch_view: '_onSwitchView', }), diff --git a/addons/board/static/tests/dashboard_tests.js b/addons/board/static/tests/dashboard_tests.js index 6b3f98cd3eb..19e3ec8c6bd 100644 --- a/addons/board/static/tests/dashboard_tests.js +++ b/addons/board/static/tests/dashboard_tests.js @@ -25,19 +25,23 @@ QUnit.module('Dashboard', { display_name: {string: "Displayed name", type: "char", searchable: true}, foo: {string: "Foo", type: "char", default: "My little Foo Value", searchable: true}, bar: {string: "Bar", type: "boolean"}, + int_field: {string: "Integer field", type: "integer"}, }, records: [{ id: 1, display_name: "first record", foo: "yop", + int_field: 3, }, { id: 2, display_name: "second record", foo: "lalala", + int_field: 5, }, { id: 4, display_name: "aaa", foo: "abc", + int_field: 2, }], }, }; @@ -859,4 +863,47 @@ QUnit.test("Dashboard should use correct groupby", function (assert) { form.destroy(); }); + +QUnit.test('click on a cell of pivot view inside dashboard', function (assert) { + assert.expect(3); + + var form = createView({ + View: BoardView, + model: 'board', + data: this.data, + arch: '<form>' + + '<board style="2-1">' + + '<column>' + + '<action view_mode="pivot" string="ABC" name="51"></action>' + + '</column>' + + '</board>' + + '</form>', + mockRPC: function (route) { + if (route === '/web/action/load') { + return $.when({ + res_model: 'partner', + views: [[4, 'pivot']], + }); + } + return this._super.apply(this, arguments); + }, + archs: { + 'partner,4,pivot': '<pivot><field name="int_field" type="measure"/></pivot>', + }, + intercepts: { + do_action: function () { + assert.step('do action'); + }, + }, + }); + + assert.verifySteps([]); + + testUtils.dom.click(form.$('.o_pivot .o_pivot_cell_value')); + + assert.verifySteps(['do action']); + + form.destroy(); +}); + }); |
