diff --git a/models/mrp_production.py b/models/mrp_production.py index 0d4c12e..9e1ab41 100644 --- a/models/mrp_production.py +++ b/models/mrp_production.py @@ -164,6 +164,8 @@ class MrpProduction(models.Model): # Only auto-fix if it's a microscopic rounding drift (not a user overriding quantity intentionally) if 0.000001 < abs(diff) < (move.product_uom.rounding * 1.5): for ml in move.move_line_ids: + if not ml.product_id: + continue # Safely apply the tiny difference to the first line that has enough quantity if ml.quantity and ml.quantity + diff >= 0: ml.quantity += diff @@ -176,6 +178,8 @@ class MrpProduction(models.Model): diff = clean_total - total_done if 0.000001 < abs(diff) < (move.product_uom.rounding * 1.5): for ml in move.move_line_ids: + if not ml.product_id: + continue if ml.quantity and ml.quantity + diff >= 0: ml.quantity += diff break