diff --git a/addons/web/static/src/legacy/js/views/list/list_editable_renderer.js b/addons/web/static/src/legacy/js/views/list/list_editable_renderer.js index ad09ed96035..55a24ea75df 100644 --- a/addons/web/static/src/legacy/js/views/list/list_editable_renderer.js +++ b/addons/web/static/src/legacy/js/views/list/list_editable_renderer.js @@ -1754,7 +1754,7 @@ ListRenderer.include({ // Fix container width to prevent the table from overflowing when being resized if (!this.el.style.width) { - this.el.style.width = `${initialTableWidth}px`; + this.el.style.width = `${this.el.offsetWidth}px`; } // Apply classes to table and selected column diff --git a/addons/web/static/tests/legacy/views/list_tests.js b/addons/web/static/tests/legacy/views/list_tests.js index e3fe29ae32a..0aa773b1b72 100644 --- a/addons/web/static/tests/legacy/views/list_tests.js +++ b/addons/web/static/tests/legacy/views/list_tests.js @@ -11453,6 +11453,47 @@ QUnit.module('Views', { form.destroy(); }); + QUnit.test('resize column with x2many list with several fields in form notebook', async function (assert) { + assert.expect(1); + + this.data.foo.records[0].o2m = [1, 2]; + + const form = await createView({ + View: FormView, + model: 'foo', + data: this.data, + arch: ` +
+ + + + + + + + + + + + + + +
`, + res_id: 1, + }); + + const th = form.el.getElementsByTagName('th')[0]; + const resizeHandle = th.getElementsByClassName('o_resize')[0]; + const listInitialWidth = form.el.querySelector('.o_list_view').offsetWidth; + + await testUtils.dom.dragAndDrop(resizeHandle, form.el.getElementsByTagName('th')[1], { position: "right" }); + + assert.strictEqual(form.el.querySelector('.o_list_view').offsetWidth, listInitialWidth, + "resizing the column should not impact the width of list"); + + form.destroy(); + }); + QUnit.test('enter edition in editable list with ', async function (assert) { assert.expect(1);