[FIX] stock: do not copy package_level_id

- 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) <sle@openerp.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-05-25 11:14:36 +00:00
parent cb71a75b12
commit 9d758fa2e1
+1 -1
View File
@@ -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')