From 60f4cdb6b111f4cfe560857a0b711bdbd57d672d Mon Sep 17 00:00:00 2001 From: clesgow Date: Wed, 8 Mar 2023 16:56:48 +0000 Subject: [PATCH] [FIX] mrp: Adapt to new produce_delays Following 6825c44, the `produce_delay` is now defined on the bom rather than on the product, thus raising a traceback when trying to access it from the product. Part-of: odoo/odoo#118023 --- addons/mrp/report/mrp_report_mo_overview.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/mrp/report/mrp_report_mo_overview.py b/addons/mrp/report/mrp_report_mo_overview.py index e879c38b1fd..0fe4ec390fc 100644 --- a/addons/mrp/report/mrp_report_mo_overview.py +++ b/addons/mrp/report/mrp_report_mo_overview.py @@ -340,7 +340,7 @@ class ReportMoOverview(models.AbstractModel): if all_available: return self._format_receipt_date('expected', doc_in.date_finished) - new_date = max_date_start + timedelta(days=doc_in.product_id.produce_delay) + new_date = max_date_start + timedelta(days=doc_in.bom_id.produce_delay) receipt_state = 'estimated' if some_estimated else 'expected' return self._format_receipt_date(receipt_state, new_date) return self._format_receipt_date('unavailable') @@ -427,8 +427,11 @@ class ReportMoOverview(models.AbstractModel): wh_manufacture_rules = product._get_rules_from_location(product.property_stock_production, route_ids=warehouse.route_ids) wh_manufacture_rules -= rules rules_delay += sum(rule.delay for rule in wh_manufacture_rules) + related_bom = self.env['mrp.bom']._bom_find(product)[product] + if not related_bom: + return False return { - 'delay': product.produce_delay + rules_delay, + 'delay': related_bom.produce_delay + rules_delay, 'cost': product.standard_price * uom_id._compute_quantity(quantity, product.uom_id), } return False