diff --git a/addons/web/static/src/views/list/list_renderer.js b/addons/web/static/src/views/list/list_renderer.js index 0da9c2e0f28..5f40df65d41 100644 --- a/addons/web/static/src/views/list/list_renderer.js +++ b/addons/web/static/src/views/list/list_renderer.js @@ -280,6 +280,9 @@ export class ListRenderer extends Component { hasLabel: true, label: propertyField.string, sortable: false, + attrs: ["integer", "float"].includes(propertyField.type) + ? { sum: propertyField.string } + : {}, }; }); } diff --git a/addons/web/static/tests/views/list_view_tests.js b/addons/web/static/tests/views/list_view_tests.js index 489eeaf5da1..818e0264643 100644 --- a/addons/web/static/tests/views/list_view_tests.js +++ b/addons/web/static/tests/views/list_view_tests.js @@ -18732,6 +18732,11 @@ QUnit.module("Views", (hooks) => { await clickSave(target); assert.strictEqual(target.querySelector(".o_field_cell.o_integer_cell").textContent, "321"); + assert.strictEqual( + target.querySelector(".o_list_footer .o_list_number").textContent, + "567", + "First property is 321, second is zero because it has a different parent and the 2 others are 123 so the total should be 321 + 123 * 2 = 567" + ); }); QUnit.test("Properties: float", async (assert) => { @@ -18780,6 +18785,11 @@ QUnit.module("Views", (hooks) => { await clickSave(target); assert.strictEqual(target.querySelector(".o_field_cell.o_float_cell").textContent, "3.21"); + assert.strictEqual( + target.querySelector(".o_list_footer .o_list_number").textContent, + "250.11", + "First property is 3.21, second is zero because it has a different parent and the 2 others are 123.45 so the total should be 3.21 + 123.45 * 2 = 250.11" + ); }); QUnit.test("Properties: date", async (assert) => {