From 48d327b8ce16feb81a16a74a38179639cad23ea6 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 13 Nov 2015 22:03:03 +0100 Subject: [PATCH] [IMP] mrp_hook: Provide hooks for _bom_explode method As we are struggled by the structure of core current code, and https://github.com/odoo/odoo/pull/8885 hasn't been accepted in v8, we need to make this hard move to allow a lot of workarounds like modules not depending this one, but anyway the method itself is not too much inheritable. --- .../__openerp__.py | 5 ++--- .../models/mrp_bom.py | 17 ++++++----------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/mrp_operations_start_without_material/__openerp__.py b/mrp_operations_start_without_material/__openerp__.py index a937e0ab5..1b89d1b98 100644 --- a/mrp_operations_start_without_material/__openerp__.py +++ b/mrp_operations_start_without_material/__openerp__.py @@ -1,5 +1,4 @@ - -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify @@ -19,7 +18,7 @@ { 'name': 'MRP Operations start without material', - 'version': '1.0', + 'version': '8.0.1.0.1', 'author': 'OdooMRP team', 'contributors': ["Daniel Campos ", "Pedro M. Baeza ", diff --git a/mrp_operations_start_without_material/models/mrp_bom.py b/mrp_operations_start_without_material/models/mrp_bom.py index e70bc8d2c..13c2ac01d 100644 --- a/mrp_operations_start_without_material/models/mrp_bom.py +++ b/mrp_operations_start_without_material/models/mrp_bom.py @@ -3,20 +3,15 @@ # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## -from openerp import models +from openerp import models, api class MrpBom(models.Model): _inherit = 'mrp.bom' - def _get_workorder_operations(self, result2, factor, level=0, - routing_id=False): - res = super(MrpBom, self)._get_workorder_operations( - result2, factor, level, routing_id) - for work_order in res: - seq = work_order['sequence'] - level - rl = self._get_routing_line_from_workorder( - routing_id, seq, work_order['workcenter_id'], - work_order['name']) - work_order['init_without_material'] = rl.init_without_material + @api.multi + def _prepare_wc_line(self, wc_use, level=0, factor=1): + res = super(MrpBom, self)._prepare_wc_line( + wc_use, level=level, factor=factor) + res['init_without_material'] = wc_use.init_without_material return res