[IMP] web: use formatFloatFactor for float_toggle widget
Before this commit, the formatter used for `float_toggle` widget is `formatFloat` function, but the `value` parameter should be computed with the factor set on the widget. This calculation is also done in `formatFloatFactor` function before calling the formatFloat function. This commit uses the `formatFloatFactor` to uniform the code instead of doing the calculation in 2 different sides (one in the widget and one in the `formatFloatFactor`). task-2702636 Part-of: odoo/odoo#108605
This commit is contained in:
committed by
Xavier Bol (xbo)
parent
4d760b9e8c
commit
fc67391f5b
@@ -1,7 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { formatFloat } from "../formatters";
|
||||
import { formatFloatFactor } from "../formatters";
|
||||
import { standardFieldProps } from "../standard_field_props";
|
||||
|
||||
import { Component } from "@odoo/owl";
|
||||
@@ -46,8 +46,9 @@ export class FloatToggleField extends Component {
|
||||
return !this.props.digits && Array.isArray(fieldDigits) ? fieldDigits : this.props.digits;
|
||||
}
|
||||
get formattedValue() {
|
||||
return formatFloat(this.props.record.data[this.props.name] * this.factor, {
|
||||
return formatFloatFactor(this.props.record.data[this.props.name], {
|
||||
digits: this.digits,
|
||||
factor: this.factor,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user