From 39162d0ff0f8e8b0317382bae5905ae092b1037c Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 30 Aug 2018 13:43:20 +0200 Subject: [PATCH] [FIX] point_of_sale: multiple lot numbers - Product tracked by lot: 3 units of lot A 2 units of lot B - On the operation type 'PoS Order', only tick 'create new SN/LN' - Make 2 PoS orders for 2 units. - Close the PoS session. The first picking (2 units of lot A) is done, but the second picking is ready but not done. The issue comes from the world famous error: 'Cannot set the done quantity from this stock move, work directly with the move lines.' We apply the same logic than in commit f0028bc837bc93e355d5bda7be12231 opw-1878256 --- addons/point_of_sale/models/pos_order.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 51fdad1610b..e5da2dd479f 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -823,7 +823,10 @@ class PosOrder(models.Model): 'lot_id': lot_id, }) if not pack_lots and not float_is_zero(qty_done, precision_rounding=move.product_uom.rounding): - move.quantity_done = qty_done + if len(move._get_move_lines()) < 2: + move.quantity_done = qty_done + else: + move._set_quantity_done(qty_done) return has_wrong_lots def _prepare_bank_statement_line_payment_values(self, data):