From c18b0c7e32f4f5f96ae41f0319194a2b4a2e64bd Mon Sep 17 00:00:00 2001 From: "Achraf (abz)" Date: Fri, 2 Dec 2022 15:25:35 +0000 Subject: [PATCH] [FIX] point_of_sale: Prevent traceback if opening cash is empty A TypeError traceback that occurs in `set_cashbox_pos` was caught by Sentry. If the user validates the openingCash with an empty input, the clientside code sends an empty string instead of a number to the python code which interprets it as a number. https://github.com/odoo/odoo/blob/84347b43063fc3032da3e03b49fc57375d8324fc/addons/point_of_sale/models/pos_session.py#L1480-L1485 opw-3089337 closes odoo/odoo#107303 X-original-commit: 62f0117c0f5fad1cd435c65986d477432de00dfa Signed-off-by: Achraf --- addons/point_of_sale/static/src/js/Popups/CashOpeningPopup.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/point_of_sale/static/src/js/Popups/CashOpeningPopup.js b/addons/point_of_sale/static/src/js/Popups/CashOpeningPopup.js index 8b289b6d70e..f234267b34e 100644 --- a/addons/point_of_sale/static/src/js/Popups/CashOpeningPopup.js +++ b/addons/point_of_sale/static/src/js/Popups/CashOpeningPopup.js @@ -43,6 +43,10 @@ odoo.define('point_of_sale.CashOpeningPopup', function(require) { handleInputChange() { this.manualInputCashCount = true; this.moneyDetails = null; + this.state.notes = ""; + if (typeof(this.state.openingCash) !== "number") { + this.state.openingCash = 0; + } } }