diff --git a/addons/mrp/i18n/mrp.pot b/addons/mrp/i18n/mrp.pot index a018a25a3b3..351c4e3515e 100644 --- a/addons/mrp/i18n/mrp.pot +++ b/addons/mrp/i18n/mrp.pot @@ -1235,6 +1235,8 @@ msgstr "" msgid "" "Compute the days required to resupply all components from BoM, by either " "buying or manufacturing the components and/or subassemblies." +" Also note that purchase security lead" +" times will be added when appropriate." msgstr "" #. module: mrp @@ -1419,8 +1421,8 @@ msgstr "" #. module: mrp #: model:ir.model.fields,help:mrp.field_mrp_bom__days_to_prepare_mo msgid "" -"Create and confirm Manufacturing Orders these many days in advance, to have enough time to replenish components or manufacture semi-finished products.\n" -"Note that this does not affect the MO scheduled date, which still respects the just-in-time mechanism." +"Create and confirm Manufacturing Orders this many days in advance, to have enough time to replenish components or manufacture semi-finished products.\n" +"Note that security lead times will also be considered when appropriate." msgstr "" #. module: mrp diff --git a/addons/mrp/models/mrp_bom.py b/addons/mrp/models/mrp_bom.py index 1ca8bee00f3..8fd0c5164a3 100644 --- a/addons/mrp/models/mrp_bom.py +++ b/addons/mrp/models/mrp_bom.py @@ -87,8 +87,8 @@ class MrpBom(models.Model): help="Average lead time in days to manufacture this product. In the case of multi-level BOM, the manufacturing lead times of the components will be added. In case the product is subcontracted, this can be used to determine the date at which components should be sent to the subcontractor.") days_to_prepare_mo = fields.Float( string="Days to prepare Manufacturing Order", default=0.0, - help="Create and confirm Manufacturing Orders these many days in advance, to have enough time to replenish components or manufacture semi-finished products.\n" - "Note that this does not affect the MO scheduled date, which still respects the just-in-time mechanism.") + help="Create and confirm Manufacturing Orders this many days in advance, to have enough time to replenish components or manufacture semi-finished products.\n" + "Note that security lead times will also be considered when appropriate.") _sql_constraints = [ ('qty_positive', 'check (product_qty > 0)', 'The quantity to produce must be positive!'), diff --git a/addons/mrp/report/mrp_report_bom_structure.py b/addons/mrp/report/mrp_report_bom_structure.py index 1babde69ca8..3e253feb3f4 100644 --- a/addons/mrp/report/mrp_report_bom_structure.py +++ b/addons/mrp/report/mrp_report_bom_structure.py @@ -479,7 +479,7 @@ class ReportBomStructure(models.AbstractModel): if not found_rules: return {} rules_delay = sum(rule.delay for rule in found_rules) - return self._format_route_info(found_rules, rules_delay, warehouse, product, bom, quantity) + return self.with_context(parent_bom=parent_bom)._format_route_info(found_rules, rules_delay, warehouse, product, bom, quantity) @api.model def _need_special_rules(self, product_info, parent_bom=False, parent_product=False): @@ -497,12 +497,13 @@ class ReportBomStructure(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) + manufacturing_lead = bom.company_id.manufacturing_lead if bom and bom.company_id else 0 return { 'route_type': 'manufacture', 'route_name': manufacture_rules[0].route_id.display_name, 'route_detail': bom.display_name, - 'lead_time': bom.produce_delay + rules_delay, - 'manufacture_delay': bom.produce_delay + rules_delay, + 'lead_time': bom.produce_delay + rules_delay + manufacturing_lead, + 'manufacture_delay': bom.produce_delay + rules_delay + manufacturing_lead, } return {} diff --git a/addons/mrp/views/mrp_bom_views.xml b/addons/mrp/views/mrp_bom_views.xml index 926f3d9be3b..e00a15bea7e 100644 --- a/addons/mrp/views/mrp_bom_views.xml +++ b/addons/mrp/views/mrp_bom_views.xml @@ -153,7 +153,8 @@