From b48449364559b3a252053a95a7a51c832ca1196a Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Thu, 19 Mar 2026 13:25:17 +0700 Subject: [PATCH] fix: Add product ID check to prevent quantity adjustment errors on move lines without a product. --- models/mrp_production.py | 4 ++++ 1 file changed, 4 insertions(+) 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