From 929b92076d78ebae35c020eb76f860d479679af4 Mon Sep 17 00:00:00 2001 From: Jitendra Prajapat Date: Tue, 13 Feb 2024 10:34:52 +0530 Subject: [PATCH] [FIX] point_of_sale: total show Nan in coins pop-up Before this commit: =================== In coins/bills pop pup, if user adds some coin and removes quantity from any of the fields (blank space) then it's showing `NAN` and not calculating the other inputted value which is completely annoying. After this commit: ================== If user removes quantity from any of the fields (blank space) then the input will count `0` in the backend and calculate accordingly. task - 3728728 closes odoo/odoo#153770 Signed-off-by: Joseph Caburnay (jcb) --- .../app/utils/money_details_popup/money_details_popup.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 9fa4e281f3a..81aa6b060a4 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 @@ -21,10 +21,10 @@ export class MoneyDetailsPopup extends AbstractAwaitablePopup { }); } computeTotal(moneyDetails = this.state.moneyDetails) { - return Object.entries(moneyDetails).reduce( - (total, money) => total + money[0] * money[1], - 0 - ); + return Object.entries(moneyDetails).reduce((total, [value, inputQty]) => { + const quantity = isNaN(inputQty) ? 0 : inputQty; + return total + parseFloat(value) * quantity; + }, 0); } //@override async getPayload() {