[FIX] point_of_sale: allow to refund less than one quantity

Before this commit: if you had a pos order with one product and one
quantity, it wasn't possible to refund less that one quantity.

Steps to reproduce:
 1. Create POS order with any product -> Qty = 1.0
 2. Go to the refund page -> Select Order -> Update Qty to 0.5 -> Click
 on the 'Refund' button

The solution is to keep the input quantity in case of a single product
refund.

issue https://github.com/odoo/odoo/issues/112291

closes odoo/odoo#115671

X-original-commit: d7baf99405d2b5ee092a38e2beb3b201292b9345
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
pedrambiria
2023-03-17 20:21:20 +01:00
parent f3646f58e2
commit 7718f12c8b
@@ -471,7 +471,7 @@ export class TicketScreen extends IndependentToOrderScreen {
const toRefundDetail = this._getToRefundDetail(orderline);
const refundableQty = orderline.get_quantity() - orderline.refunded_qty;
if (this.env.pos.isProductQtyZero(refundableQty - 1)) {
if (this.env.pos.isProductQtyZero(refundableQty - 1) && toRefundDetail.qty === 0) {
toRefundDetail.qty = 1;
}
return true;