diff --git a/addons/point_of_sale/static/src/app/screens/payment_screen/payment_lines/payment_lines.js b/addons/point_of_sale/static/src/app/screens/payment_screen/payment_lines/payment_lines.js
index e9963f75a0e..2a587ef4b1b 100644
--- a/addons/point_of_sale/static/src/app/screens/payment_screen/payment_lines/payment_lines.js
+++ b/addons/point_of_sale/static/src/app/screens/payment_screen/payment_lines/payment_lines.js
@@ -5,6 +5,7 @@ import { NumberPopup } from "@point_of_sale/app/utils/input_popups/number_popup"
import { useService } from "@web/core/utils/hooks";
import { Component, useState } from "@odoo/owl";
import { usePos } from "@point_of_sale/app/store/pos_hook";
+import { parseFloat } from "@web/views/fields/parsers";
export class PaymentScreenPaymentLines extends Component {
static template = "point_of_sale.PaymentScreenPaymentLines";
@@ -30,7 +31,7 @@ export class PaymentScreenPaymentLines extends Component {
if (this.ui.isSmall) {
const { confirmed, payload } = await this.popup.add(NumberPopup, {
title: _t("New amount"),
- startingValue: parseFloat(paymentline.amount),
+ startingValue: paymentline.amount,
isInputSelected: true,
nbrDecimal: this.pos.currency.decimal_places,
});
diff --git a/addons/point_of_sale/static/src/app/utils/money_details_popup/money_details_popup.js b/addons/point_of_sale/static/src/app/utils/money_details_popup/money_details_popup.js
index 836fe5f3cf1..9fa4e281f3a 100644
--- a/addons/point_of_sale/static/src/app/utils/money_details_popup/money_details_popup.js
+++ b/addons/point_of_sale/static/src/app/utils/money_details_popup/money_details_popup.js
@@ -54,4 +54,7 @@ export class MoneyDetailsPopup extends AbstractAwaitablePopup {
this.pos.logEmployeeMessage(this.props.action, "ACTION_CANCELLED");
}
}
+ _parseFloat(value) {
+ return parseFloat(value);
+ }
}
diff --git a/addons/point_of_sale/static/src/app/utils/money_details_popup/money_details_popup.xml b/addons/point_of_sale/static/src/app/utils/money_details_popup/money_details_popup.xml
index 66fdf062373..c20bdbfbef4 100644
--- a/addons/point_of_sale/static/src/app/utils/money_details_popup/money_details_popup.xml
+++ b/addons/point_of_sale/static/src/app/utils/money_details_popup/money_details_popup.xml
@@ -11,7 +11,7 @@
diff --git a/addons/pos_discount/static/src/overrides/components/discount_button/discount_button.js b/addons/pos_discount/static/src/overrides/components/discount_button/discount_button.js
index 7346b5c0608..76dfae0e24e 100644
--- a/addons/pos_discount/static/src/overrides/components/discount_button/discount_button.js
+++ b/addons/pos_discount/static/src/overrides/components/discount_button/discount_button.js
@@ -7,6 +7,7 @@ import { NumberPopup } from "@point_of_sale/app/utils/input_popups/number_popup"
import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";
import { Component } from "@odoo/owl";
import { usePos } from "@point_of_sale/app/store/pos_hook";
+import { parseFloat } from "@web/views/fields/parsers";
export class DiscountButton extends Component {
static template = "pos_discount.DiscountButton";
diff --git a/addons/pos_restaurant/static/src/app/tip_screen/tip_screen.js b/addons/pos_restaurant/static/src/app/tip_screen/tip_screen.js
index 7cf3fa325df..5f99d32fa4e 100644
--- a/addons/pos_restaurant/static/src/app/tip_screen/tip_screen.js
+++ b/addons/pos_restaurant/static/src/app/tip_screen/tip_screen.js
@@ -26,7 +26,9 @@ export class TipScreen extends Component {
});
}
get overallAmountStr() {
- const tipAmount = parseFloat(this.state.inputTipAmount || "0");
+ const tipAmount = this.env.utils.isValidFloat(this.state.inputTipAmount)
+ ? parseFloat(this.state.inputTipAmount)
+ : 0;
const original = this.env.utils.formatCurrency(this.totalAmount);
const tip = this.env.utils.formatCurrency(tipAmount);
const overall = this.env.utils.formatCurrency(this.totalAmount + tipAmount);
@@ -46,7 +48,9 @@ export class TipScreen extends Component {
];
}
async validateTip() {
- const amount = parseFloat(this.state.inputTipAmount) || 0;
+ const amount = this.env.utils.isValidFloat(this.state.inputTipAmount)
+ ? parseFloat(this.state.inputTipAmount)
+ : 0;
const order = this.pos.get_order();
const serverId = this.pos.validated_orders_name_server_id_map[order.name];
diff --git a/addons/pos_restaurant/static/src/overrides/components/ticket_screen/ticket_screen.js b/addons/pos_restaurant/static/src/overrides/components/ticket_screen/ticket_screen.js
index 73906630fc5..ecfc1f35217 100644
--- a/addons/pos_restaurant/static/src/overrides/components/ticket_screen/ticket_screen.js
+++ b/addons/pos_restaurant/static/src/overrides/components/ticket_screen/ticket_screen.js
@@ -60,7 +60,9 @@ patch(TicketScreen.prototype, {
async settleTips() {
// set tip in each order
for (const order of this.getFilteredOrderList()) {
- const tipAmount = parseFloat(order.uiState.TipScreen.inputTipAmount || "0");
+ const tipAmount = this.env.utils.isValidFloat(order.uiState.TipScreen.inputTipAmount)
+ ? parseFloat(order.uiState.TipScreen.inputTipAmount)
+ : 0;
const serverId = this.pos.validated_orders_name_server_id_map[order.name];
if (!serverId) {
console.warn(
@@ -143,7 +145,11 @@ export class TipCell extends Component {
useAutofocus();
}
get tipAmountStr() {
- return this.env.utils.formatCurrency(parseFloat(this.orderUiState.inputTipAmount || "0"));
+ return this.env.utils.formatCurrency(
+ this.env.utils.isValidFloat(this.orderUiState.inputTipAmount)
+ ? parseFloat(this.orderUiState.inputTipAmount)
+ : 0
+ );
}
onBlur() {
this.state.isEditing = false;