diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js index d9cc1115917..1aec18f6fb7 100644 --- a/addons/web/static/src/js/views/list/list_editable_renderer.js +++ b/addons/web/static/src/js/views/list/list_editable_renderer.js @@ -339,9 +339,7 @@ ListRenderer.include({ * @returns {boolean} */ inMultipleRecordEdition: function (recordId) { - const record = this._getRecord(recordId) || {}; - const recordIds = [...new Set([recordId, ...this.selection])]; - return this.editable && recordIds.length > 1 && record.res_id; + return this.editable && this.selection.length > 1 && this.selection.includes(recordId); }, /** * Removes the line associated to the given recordID (the index of the row diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 245a5ac21b3..16dfad681ac 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -5273,6 +5273,32 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('editable list view: single edition with selected records', async function (assert) { + assert.expect(2); + + const list = await createView({ + arch: ``, + data: this.data, + model: 'foo', + View: ListView, + }); + + // Select first record + await testUtils.dom.click(list.$('.o_data_row:eq(0) .o_list_record_selector input')); + + // Edit the second + await testUtils.dom.click(list.$('.o_data_row:eq(1) .o_data_cell:first()')); + await testUtils.fields.editInput(list.$('.o_data_row:eq(1) .o_data_cell:first() input'), "oui"); + await testUtils.dom.click($('.o_list_button_save')); + + assert.strictEqual(list.$('.o_data_row:eq(0) .o_data_cell:first()').text(), "yop", + "First row should remain unchanged"); + assert.strictEqual(list.$('.o_data_row:eq(1) .o_data_cell:first()').text(), "oui", + "Second row should have been updated"); + + list.destroy(); + }); + QUnit.test('editable list view: multi edition', async function (assert) { assert.expect(22); @@ -5323,8 +5349,6 @@ QUnit.module('Views', { assert.verifySteps(['create', 'read']); // edit a field - // We deliberately unselect the first row to check the multi edit union (recordId + selectedRecordIds) - await testUtils.dom.click(list.$('.o_data_row:eq(0) .o_list_record_selector input')); await testUtils.dom.click(list.$('.o_data_row:eq(0) .o_data_cell:eq(1)')); await testUtils.fields.editInput(list.$('.o_field_widget[name=int_field]'), 666); await testUtils.dom.click(list.$('.o_data_row:eq(0) .o_data_cell:eq(0)'));