From ef7664bd8a4b84fd6e0acb85a116d610f2b24b08 Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Mon, 24 Jan 2022 09:07:07 +0000 Subject: [PATCH] [FIX] stock: b2b pack in reception Usecase to reproduce: - Create a planned receipt of 10 product A - Set quantity done to 10 - Put in Pack Actual result: UerError "There is not move line to pack" Expected result: Pack them It happens because since we are in a receipt without suggestion (by default) then the fields `move_line_nosuggest_ids` is used. But `_set_quantity_done` on `stock.move` will first try to fill move line with reservation before creating new ones. So the move_line_nosuggest_ids will not contain the quantity done on planned quantity closes odoo/odoo#83430 X-original-commit: 3c7453a61372d6ecdeae099d49cbc79844c144ae Related: odoo/enterprise#23767 Signed-off-by: Tiffany Chang Signed-off-by: Arnold Moyaux --- addons/stock/models/stock_picking.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 9ac69b8f43d..415031f1d60 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -355,7 +355,9 @@ class Picking(models.Model): default=lambda self: self.env.user) move_line_ids = fields.One2many('stock.move.line', 'picking_id', 'Operations') move_line_ids_without_package = fields.One2many('stock.move.line', 'picking_id', 'Operations without package', domain=['|',('package_level_id', '=', False), ('picking_type_entire_packs', '=', False)]) - move_line_nosuggest_ids = fields.One2many('stock.move.line', 'picking_id', domain=[('reserved_qty', '=', 0.0)]) + move_line_nosuggest_ids = fields.One2many( + 'stock.move.line', 'picking_id', + domain=['|', ('reserved_qty', '=', 0.0), '&', ('reserved_qty', '!=', 0.0), ('qty_done', '!=', 0.0)]) move_line_exist = fields.Boolean( 'Has Pack Operations', compute='_compute_move_line_exist', help='Check the existence of pack operation on the picking')