diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py
index 7d3ad683c..10e33f7ea 100644
--- a/mrp_operations_extension/models/mrp_bom.py
+++ b/mrp_operations_extension/models/mrp_bom.py
@@ -31,11 +31,13 @@ class MrpBom(models.Model):
bom, product, factor, properties=properties, level=level,
routing_id=routing_id, previous_products=previous_products,
master_bom=master_bom)
- result2 = self._get_workorder_operations(result2, level=level,
+ result2 = self._get_workorder_operations(result2, factor=factor,
+ level=level,
routing_id=routing_id)
return result, result2
- def _get_workorder_operations(self, result2, level=0, routing_id=False):
+ def _get_workorder_operations(self, result2, factor, level=0,
+ routing_id=False):
routing_line_obj = self.env['mrp.routing.workcenter']
for work_order in result2:
seq = work_order['sequence'] - level
@@ -50,9 +52,18 @@ class MrpBom(models.Model):
if name_val in work_order['name']:
routing_line_id = routing_line.id
break
+ wc = routing_line_obj.browse(routing_line_id)
+ cycle = factor / wc.cycle_nbr
+ if wc.limited_production_capacity and not cycle.is_integer():
+ cycle = int(cycle) + 1
+ hour = wc.hour_nbr * cycle
+ default_wc_line = wc.op_wc_lines.filtered(lambda r: r.default)
+ work_order['cycle'] = cycle
+ work_order['hour'] = hour
+ work_order['time_start'] = default_wc_line.time_start or 0.0
+ work_order['time_stop'] = default_wc_line.time_stop or 0.0
if 'routing_wc_line' not in work_order:
work_order['routing_wc_line'] = routing_line_id
- wc = self.env['mrp.routing.workcenter'].browse(routing_line_id)
work_order['do_production'] = wc.do_production
return result2
diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py
index 77ecd59ef..8b01aeb15 100644
--- a/mrp_operations_extension/models/mrp_production.py
+++ b/mrp_operations_extension/models/mrp_production.py
@@ -85,3 +85,5 @@ class MrpProductionWorkcenterLine(models.Model):
routing_wc_line = fields.Many2one('mrp.routing.workcenter',
string='Routing WC Line')
do_production = fields.Boolean(string='Produce here')
+ time_start = fields.Float(string="Time Start")
+ time_stop = fields.Float(string="Time Stop")
diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml
index 93edf1c9e..2ea1314fa 100644
--- a/mrp_operations_extension/views/mrp_production_view.xml
+++ b/mrp_operations_extension/views/mrp_production_view.xml
@@ -47,6 +47,10 @@
+
+
+
+
2
diff --git a/mrp_operations_extension/wizard/mrp_product_produce.py b/mrp_operations_extension/wizard/mrp_product_produce.py
index 4a0db7319..70f2662e1 100644
--- a/mrp_operations_extension/wizard/mrp_product_produce.py
+++ b/mrp_operations_extension/wizard/mrp_product_produce.py
@@ -52,7 +52,8 @@ class MrpWorkOrderProduce(models.TransientModel):
assert production_id
data = self.browse(cr, uid, ids[0], context=context)
self.pool['mrp.production'].action_produce(
- cr, uid, production_id, False, data.mode, data, context=context)
+ cr, uid, production_id, data.product_qty,
+ data.mode, data, context=context)
return {}
def do_consume(self, cr, uid, ids, context=None):
@@ -72,7 +73,7 @@ class MrpWorkOrderProduce(models.TransientModel):
assert production_id
data = self.browse(cr, uid, ids[0], context=context)
self.pool['mrp.production'].action_produce(
- cr, uid, production_id, False, 'consume_produce', data,
+ cr, uid, production_id, data.product_qty, 'consume_produce', data,
context=context)
return {}
diff --git a/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml b/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml
index 67be6b803..d73c5bbb2 100644
--- a/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml
+++ b/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml
@@ -45,7 +45,7 @@
- MRP Work Order Produce
+ MRP Work Order Consume
mrp.work.order.produce