diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index 81667d8b7..ab3ee252e 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -17,6 +17,7 @@ ############################################################################## from openerp import models, fields, api, exceptions, _ +import math class MrpProduction(models.Model): @@ -56,6 +57,12 @@ class MrpProduction(models.Model): def _get_workorder_in_product_lines( self, workcenter_lines, product_lines, properties=None): + for workorder in workcenter_lines: + wc = workorder.routing_wc_line + cycle = wc.cycle_nbr and int(math.ceil(self.product_qty / + wc.cycle_nbr)) or 0 + workorder.cycle = cycle + workorder.hour = wc.hour_nbr * cycle for p_line in product_lines: for bom_line in self.bom_id.bom_line_ids: if bom_line.product_id.id == p_line.product_id.id: