diff --git a/addons/web/static/src/views/list/list_renderer.js b/addons/web/static/src/views/list/list_renderer.js
index 51d982e3eb3..8034c854769 100644
--- a/addons/web/static/src/views/list/list_renderer.js
+++ b/addons/web/static/src/views/list/list_renderer.js
@@ -888,8 +888,6 @@ export class ListRenderer extends Component {
const list = this.props.list;
if (this.isSortable(column)) {
list.sortBy(fieldName);
- // don't resize column when reordering.
- this.keepColumnWidths = true;
}
}
@@ -1756,6 +1754,8 @@ export class ListRenderer extends Component {
// Mouse or keyboard events : stop resize
const stopResize = (ev) => {
this.resizing = false;
+ // freeze column size after resizing
+ this.keepColumnWidths = true;
// Ignores the 'left mouse button down' event as it used to start resizing
if (ev.type === "mousedown" && ev.which === 1) {
return;
diff --git a/addons/web/static/tests/views/list_view_tests.js b/addons/web/static/tests/views/list_view_tests.js
index 82dde9e62cb..1da85e5a3e9 100644
--- a/addons/web/static/tests/views/list_view_tests.js
+++ b/addons/web/static/tests/views/list_view_tests.js
@@ -15304,6 +15304,70 @@ QUnit.module("Views", (hooks) => {
assertAlmostEqual(th2.offsetWidth, widthsAfterReorder[1] + widthsAfterReorder[2] / 2);
});
+ QUnit.test("list: resize column and toggle one checkbox", async function (assert) {
+ await makeView({
+ type: "list",
+ resModel: "foo",
+ serverData,
+ arch: `
+
+
+
+ `,
+ });
+
+ // 1. Resize column foo to middle of column int_field.
+ const th2 = target.querySelector("th:nth-child(2)");
+ const th3 = target.querySelector("th:nth-child(3)");
+ const resizeHandle = th2.querySelector(".o_resize");
+
+ await dragAndDrop(resizeHandle, th3);
+
+ const widthsAfterResize = [...target.querySelectorAll(".o_list_table th")].map(
+ (th) => th.offsetWidth
+ );
+
+ // 2. Column size should be the same after selecting a row
+ await click(target.querySelector("tbody .o_list_record_selector"));
+ const widthsAfterSelectRow = [...target.querySelectorAll(".o_list_table th")].map(
+ (th) => th.offsetWidth
+ );
+ assert.strictEqual(widthsAfterResize[0], widthsAfterSelectRow[0], "Width must not have been changed after selecting a row");
+ assert.strictEqual(widthsAfterResize[1], widthsAfterSelectRow[1], "Width must not have been changed after selecting a row");
+ });
+
+ QUnit.test("list: resize column and toggle check all", async function (assert) {
+ await makeView({
+ type: "list",
+ resModel: "foo",
+ serverData,
+ arch: `
+
+
+
+ `,
+ });
+
+ // 1. Resize column foo to middle of column int_field.
+ const th2 = target.querySelector("th:nth-child(2)");
+ const th3 = target.querySelector("th:nth-child(3)");
+ const resizeHandle = th2.querySelector(".o_resize");
+
+ await dragAndDrop(resizeHandle, th3);
+
+ const widthsAfterResize = [...target.querySelectorAll(".o_list_table th")].map(
+ (th) => th.offsetWidth
+ );
+
+ // 2. Column size should be the same after selecting all
+ await click(target.querySelector("thead .o_list_record_selector"));
+ const widthsAfterSelectAll = [...target.querySelectorAll(".o_list_table th")].map(
+ (th) => th.offsetWidth
+ );
+ assert.strictEqual(widthsAfterResize[0], widthsAfterSelectAll[0], "Width must not have been changed after selecting all");
+ assert.strictEqual(widthsAfterResize[1], widthsAfterSelectAll[1], "Width must not have been changed after selecting all");
+ });
+
QUnit.test("editable list: resize column headers", async function (assert) {
await makeView({
type: "list",