[FIX] mrp: fix format of bom quantity in mrp_report_bom report

If you are using a locale that uses "," as decimal_point and "." as
thousand_seps the parseFloat around formatFloat is not parsing correctly
the float because the parseFloat is not locale-based but uses always the
"." as decimal point. example: in Italy the thousand separator is ".".
parseFloat("3.000,00000") returns "3" as result but the correct result
is "3000" . It is not necessary to use formatFloat but it is needed

closes odoo/odoo#123711

X-original-commit: 48dd3d189a50b4b2a25ce0c3cf6dca0f744fd928
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
Michele
2023-06-05 17:51:29 +02:00
committed by William Henrotin
parent 32c7c35ac9
commit 97d07c8e01
@@ -5,7 +5,6 @@ import { BomOverviewDisplayFilter } from "../bom_overview_display_filter/mrp_bom
import { Dropdown } from "@web/core/dropdown/dropdown";
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
import { Many2XAutocomplete } from "@web/views/fields/relational_utils";
import { formatFloat } from "@web/views/fields/formatters";
const { Component } = owl;
@@ -17,7 +16,7 @@ export class BomOverviewControlPanel extends Component {
//---- Handlers ----
updateQuantity(ev) {
const newVal = isNaN(ev.target.value) ? 1 : parseFloat(formatFloat(parseFloat(ev.target.value), { digits: [false, this.precision] }));
const newVal = isNaN(ev.target.value) ? 1 : parseFloat(parseFloat(ev.target.value).toFixed(this.precision));
this.props.changeBomQuantity(newVal);
}