[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) <aab@odoo.com>
This commit is contained in:
Mohammed Shekha
2020-06-08 11:29:59 +00:00
committed by Aaron Bohy
parent 9ffd3cda87
commit 030d8ec6f0
2 changed files with 35 additions and 0 deletions
@@ -447,6 +447,7 @@ var ListController = BasicController.extend({
keepWidths: true,
selectedRecords: [],
});
this._updateSelectionBox();
this.renderer.focusCell(recordId, node);
resolve(!Object.keys(changes).length);
})
@@ -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: '<tree multi_edit="1"><field name="foo"/><field name="bar"/></tree>',
});
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);