[FIX] web: decimal property crash in list view

Bug
===
The decimal property crash when added in a list view, if some records
have False as a value.

Technical
=========
Since fe797a03285ec9c81d29ed631839c91e2b9957a4 , we use the wrong
Formatter in the Float field.

Task-3698415

closes odoo/odoo#150682

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
std-odoo
2024-01-24 10:44:41 +00:00
parent f003eaf884
commit 9792d5d761
2 changed files with 4 additions and 4 deletions
@@ -4,7 +4,7 @@ import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { useInputField } from "../input_field_hook";
import { useNumpadDecimal } from "../numpad_decimal_hook";
import { formatFloat } from "@web/core/utils/numbers";
import { formatFloat } from "../formatters";
import { parseFloat } from "../parsers";
import { standardFieldProps } from "../standard_field_props";
@@ -18820,7 +18820,7 @@ QUnit.module("Views", (hooks) => {
serverData.models.bar.records[0].definitions = [definition];
for (const record of serverData.models.foo.records) {
if (record.m2o === 1) {
record.properties = [{ ...definition, value: 123.45 }];
record.properties = [{ ...definition, value: record.id === 4 ? false : 123.45 }];
}
}
@@ -18859,8 +18859,8 @@ QUnit.module("Views", (hooks) => {
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"
"126.66",
"First property is 3.21, second is zero because it has a different parent the other is 123.45 and the last one zero because it is false so the total should be 3.21 + 123.45 = 126.66"
);
});