[FIX] mrp: quantity_done with tracked products
Steps to reproduce the bug: - Create 3 stockable products P1, P2, P3 - P1 is tracked by serial numbers - Create a BOM for P3 with one P1 and one P2 as components - Set the quantity on hand to 5 for P1 and P2 - Create a MO for P3, produce it and mark the MO as done - On the MO in the sheet "Consumed product", the quantity_done for P1 and P2 are equal to 1.0 - Change the tracking of P1 to "No tracking" Bug: - Check the sheet "Consumed product" on the MO and the quantity_done was equal to 0.0 instead of 1.0 opw:1856340
This commit is contained in:
@@ -117,7 +117,7 @@ class StockMove(models.Model):
|
||||
@api.depends('move_lot_ids', 'move_lot_ids.quantity_done', 'quantity_done_store')
|
||||
def _qty_done_compute(self):
|
||||
for move in self:
|
||||
if move.has_tracking != 'none':
|
||||
if move.has_tracking != 'none' or move.sudo().move_lot_ids.mapped('lot_id'):
|
||||
move.quantity_done = sum(move.move_lot_ids.filtered(lambda x: x.done_wo).mapped('quantity_done')) #TODO: change with active_move_lot_ids?
|
||||
else:
|
||||
move.quantity_done = move.quantity_done_store
|
||||
|
||||
Reference in New Issue
Block a user