From 030d8ec6f0fd9590d59bfa0576c965f812e2abeb Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Fri, 29 May 2020 10:59:30 +0000 Subject: [PATCH] [FIX] web: hide list selection box after multi record save Before this commit, list selection box was not hidden after multi record edition. task-2266999 closes odoo/odoo#52590 X-original-commit: ac46e9f82b7cbfc55f395b66b2011399b9f972f1 Signed-off-by: Aaron Bohy (aab) --- .../src/js/views/list/list_controller.js | 1 + addons/web/static/tests/views/list_tests.js | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js index a6e570f1215..800a09f32be 100644 --- a/addons/web/static/src/js/views/list/list_controller.js +++ b/addons/web/static/src/js/views/list/list_controller.js @@ -447,6 +447,7 @@ var ListController = BasicController.extend({ keepWidths: true, selectedRecords: [], }); + this._updateSelectionBox(); this.renderer.focusCell(recordId, node); resolve(!Object.keys(changes).length); }) diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index a0c7d4d00ce..d69aef904c1 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -1638,6 +1638,40 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('selection box is removed after multi record edition', async function (assert) { + assert.expect(6); + + const list = await createView({ + View: ListView, + model: 'foo', + data: this.data, + arch: '', + }); + + assert.containsN(list, '.o_data_row', 4, + "there should be 4 records"); + assert.containsNone(list.$('.o_cp_buttons'), '.o_list_selection_box', + "list selection box should not be displayed"); + + // select all records + await testUtils.dom.click(list.$('thead .o_list_record_selector input')); + assert.containsOnce(list.$('.o_cp_buttons'), '.o_list_selection_box', + "list selection box should be displayed"); + assert.containsN(list, '.o_data_row .o_list_record_selector input:checked', 4, + "all 4 records should be selected"); + + // edit selected records + await testUtils.dom.click(list.$('.o_data_row:eq(0) .o_data_cell:eq(0)')); + await testUtils.fields.editInput(list.$('.o_field_widget[name=foo]'), 'legion'); + await testUtils.dom.click($('.modal-dialog button.btn-primary')); + assert.containsNone(list.$('.o_cp_buttons'), '.o_list_selection_box', + "list selection box should not be displayed"); + assert.containsNone(list, '.o_data_row .o_list_record_selector input:checked', + "no records should be selected"); + + list.destroy(); + }); + QUnit.test('selection is reset on reload', async function (assert) { assert.expect(8);