[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) <jcb@odoo.com>
This commit is contained in:
Jitendra Prajapat
2024-03-27 16:10:57 +00:00
parent 91b31d105d
commit 929b92076d
@@ -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() {