[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 <tic@odoo.com>
Signed-off-by: Arnold Moyaux <arm@odoo.com>
This commit is contained in:
Arnold Moyaux
2022-02-02 16:40:49 +00:00
committed by Tiffany Chang (tic)
parent 9ec17ac219
commit ef7664bd8a
+3 -1
View File
@@ -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')