[FIX] mrp: unbuild with lot

- Create 3 products:
  A: kg, no tracking
  B: kg, tracked by lot
  AB: kg, no tracking
- Create a BOM for AB:
  1 kg of A
  30 g of B
- Create a MO for 1 kg of AB, validate and close the MO
- Unbuild the MO

A stock move for 0.03 g of B is created instead of 30 g.

This happens because we wrongly compare the quantity in the UoM of the
stock move with a normalied quantity.

opw-2278727

closes odoo/odoo#53390

X-original-commit: 6790e89f97d6bbbaab4e071af52cce9ccee98821
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-06-22 08:56:12 +00:00
parent ec1b3a11ad
commit 4658f8f0af
+1 -1
View File
@@ -181,7 +181,7 @@ class MrpUnbuild(models.Model):
if move.has_tracking != 'none':
original_move = move in produce_moves and self.mo_id.move_raw_ids or self.mo_id.move_finished_ids
original_move = original_move.filtered(lambda m: m.product_id == move.product_id)
needed_quantity = move.product_qty
needed_quantity = move.product_uom_qty
moves_lines = original_move.mapped('move_line_ids')
if move in produce_moves and self.lot_id:
moves_lines = moves_lines.filtered(lambda ml: self.lot_id in ml.produce_line_ids.lot_id) # FIXME sle: double check with arm