From 9d758fa2e180b96d4b0f7046e7a75a202c4da7ff Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 22 May 2020 12:01:04 +0000 Subject: [PATCH] [FIX] stock: do not copy `package_level_id` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Activate 'Delivery Packages', 'Storage Locations' - Open Inventory → Configuration → Operation Types - Create a new one with: name: Pack Transfer Default source location: Stock Default destination location: Stock Move Entire Packages: True - Open product [FURN_7777] Office Chair - Use button 'Update Quantity' to create a new inventory: Choose 'Shelf 1' as location Create a new package 'PACK0000001' Set any quantity - Go to Inventory → Transfers - Create a new one (WH/PT/00001) with: Operation Type: Pack Transfer - Shipping Policy: When all products are ready - Create a Package line (package level) to move the package 'PACK0000001' to Shelf 2 - Reserve the transfer WH/PT/00001 - Duplicate WH/PT/00001, which produces WH/PT/00002 From there, WH/PT/00002 seems empty, no apparent move, move line or package level. However the new transfer is misbehaving, for instance: - Add a new operation in WH/PT/00002 for 3 "[E-COM10] Pedal Bin" - Mark as todo and check availability The move for "[E-COM10] Pedal Bin" is reserved and the transfer WH/PT/00002 is "Waiting" while it should be "Ready". When the `stock.move` are duplicated, the value of `package_level_id` is copied, linking the new `stock.picking` to the wrong package. There is no need to copy the `package_level_id`. When not copied, the list of products is correctly added to the new picking, without taking packages into account. opw-2252969 closes odoo/odoo#51798 X-original-commit: ecf726ae8221e6871c1e391294c633d8b6bcaa9a Signed-off-by: Simon Lejeune (sle) Signed-off-by: Nicolas Martinelli (nim) --- addons/stock/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 8f88f677e03..77a26293786 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -172,7 +172,7 @@ class StockMove(models.Model): is_quantity_done_editable = fields.Boolean('Is quantity done editable', compute='_compute_is_quantity_done_editable') reference = fields.Char(compute='_compute_reference', string="Reference", store=True) has_move_lines = fields.Boolean(compute='_compute_has_move_lines') - package_level_id = fields.Many2one('stock.package_level', 'Package Level', check_company=True) + package_level_id = fields.Many2one('stock.package_level', 'Package Level', check_company=True, copy=False) picking_type_entire_packs = fields.Boolean(related='picking_type_id.show_entire_packs', readonly=True) display_assign_serial = fields.Boolean(compute='_compute_display_assign_serial') next_serial = fields.Char('First SN')