From 4bc155dfead75327c003dd08c4cca65792a694df Mon Sep 17 00:00:00 2001 From: roen-odoo Date: Tue, 3 May 2022 13:59:33 +0000 Subject: [PATCH] [FIX] point_of_sale: correctly reserve quantity on tracked product Current behavior: When selling a product in PoS that is tracked by lot number and using the options to shop it latter and 3 steps delivery. The move lines associted to the different pickings would have wrong quantity reserved Steps to reproduce: - Activate multi-step routes and Lot/SN in inventory - Operation types Pos Orders tracability check marked - Activate Ship later options in PoS - Set 3 steps delivery in the warehouse settings - Create an item tracked by lot number and set a quantity - Open POS session - Select created item - Do NOT input a lot number - Set quantity to 1 - Proceed to payment screen - Select "Ship Later" on the payment screen. - Finish Sale. - Close POS session. - View the picking orders of the session. - Select the picking order that is "Ready". - The reserved quanities in the pickings are not correct opw-2779462 closes odoo/odoo#90699 X-original-commit: b18710a20eb4b1fc0de79c82c885a677b84a7a70 Signed-off-by: Masereel Pierre --- addons/point_of_sale/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/stock_picking.py b/addons/point_of_sale/models/stock_picking.py index b3fb1093484..8bdc0735564 100644 --- a/addons/point_of_sale/models/stock_picking.py +++ b/addons/point_of_sale/models/stock_picking.py @@ -228,7 +228,7 @@ class StockMove(models.Model): sum_of_lots += qty if abs(line.qty) != sum_of_lots: difference_qty = abs(line.qty) - sum_of_lots - ml_vals = self[0]._prepare_move_line_vals() + ml_vals = move._prepare_move_line_vals() if line.product_id.tracking == 'serial': move_lines_to_create.extend([ml_vals for i in range(int(difference_qty))]) mls_qties.extend([1]*int(difference_qty))