From 8b101164102e1a83b28ea10f834b5d026ae27ece Mon Sep 17 00:00:00 2001 From: "Pedram (PEBR)" Date: Mon, 20 Nov 2023 11:48:56 +0000 Subject: [PATCH] [FIX] point_of_sale: maintain manual quantity for lot-tracked refunds Before this commit, refunding a lot-tracked product with a quantity greater than one in the POS would reset the quantity to one. This occurred even if the user manually set a higher quantity. This commit fixes the issue by ensuring the manually set quantity for lot-tracked products is kept during refunds. This enhancement allows for accurate quantity retention, improving the POS refund functionality. opw-3568867 closes odoo/odoo#144050 X-original-commit: e5989cee1cea150b86e6f3d5ae5f2fcdb108fd51 Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Pedram Bi Ria (pebr) --- addons/point_of_sale/static/src/app/store/models.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/app/store/models.js b/addons/point_of_sale/static/src/app/store/models.js index 3ec381655f6..8a7ee890191 100644 --- a/addons/point_of_sale/static/src/app/store/models.js +++ b/addons/point_of_sale/static/src/app/store/models.js @@ -506,7 +506,7 @@ export class Orderline extends PosModel { * @param {Object} modifiedPackLotLines key-value pair of String (the cid) & String (the new lot_name) * @param {Array} newPackLotLines array of { lot_name: String } */ - setPackLotLines({ modifiedPackLotLines, newPackLotLines }) { + setPackLotLines({ modifiedPackLotLines, newPackLotLines , setQuantity = true }) { // Set the new values for modified lot lines. const lotLinesToRemove = []; for (const lotLine of this.pack_lot_lines) { @@ -534,7 +534,7 @@ export class Orderline extends PosModel { } // Set the quantity of the line based on number of pack lots. - if (!this.product.to_weight) { + if (!this.product.to_weight && setQuantity) { this.set_quantity_by_lot(); } } @@ -2063,7 +2063,7 @@ export class Order extends PosModel { } if (options.draftPackLotLines) { - this.selected_orderline.setPackLotLines(options.draftPackLotLines); + this.selected_orderline.setPackLotLines({ ...options.draftPackLotLines, setQuantity: options.quantity === undefined }); } if (options.comboLines?.length) {