[REF] point_of_sale: replace formatFixed with formatCurrency no symbol

Part-of: odoo/odoo#120317
This commit is contained in:
Joseph Caburnay
2023-05-08 15:18:30 +02:00
parent 5d951d91bb
commit 06166d7b5a
2 changed files with 5 additions and 11 deletions
@@ -286,7 +286,11 @@ class NumberBuffer extends EventBus {
// when input is like '+10', '+50', etc
const inputValue = oParseFloat(input.slice(1));
const currentBufferValue = this.state.buffer ? oParseFloat(this.state.buffer) : 0;
this.state.buffer = this.component.env.pos.formatFixed(inputValue + currentBufferValue);
// FIXME POSREF: the `buffer` shouldn't be dependent on the currency.
this.state.buffer = this.component.env.utils.formatCurrency(
inputValue + currentBufferValue,
false
);
} else if (!isNaN(parseInt(input, 10))) {
if (this.state.toStartOver) {
// when we want to erase the current buffer for a new value
@@ -1508,16 +1508,6 @@ export class PosGlobalState extends PosModel {
return parseFloat(round_di(value, decimals).toFixed(decimals));
}
/**
* (value = 1.0000, decimals = 2) => '1'
* (value = 1.1234, decimals = 2) => '1.12'
* @param {number} value amount to format
*/
formatFixed(value) {
const currency = this.currency || { decimal_places: 2 };
return `${Number(value.toFixed(currency.decimal_places || 0))}`;
}
disallowLineQuantityChange() {
return false;
}