From 4eabc8f1863a255efc439c4bf731da3995cbed61 Mon Sep 17 00:00:00 2001 From: Jagdish Panchal Date: Thu, 2 May 2013 11:55:51 +0530 Subject: [PATCH] [IMP] Improve code for mrp work flow bzr revid: jap@tinyerp.com-20130502062551-tk4jlx4l61rhhhce --- addons/mrp/mrp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index df798762b5a..04c567fec90 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -982,6 +982,7 @@ class mrp_production(osv.osv): wf_service = netsvc.LocalService("workflow") uncompute_ids = filter(lambda x:x, [not x.product_lines and x.id or False for x in self.browse(cr, uid, ids, context=context)]) self.action_compute(cr, uid, uncompute_ids, context=context) + for production in self.browse(cr, uid, ids, context=context): shipment_id = self._make_production_internal_shipment(cr, uid, production, context=context) produce_move_id = self._make_production_produce_line(cr, uid, production, context=context) @@ -996,7 +997,9 @@ class mrp_production(osv.osv): shipment_move_id = self._make_production_internal_shipment_line(cr, uid, line, shipment_id, consume_move_id,\ destination_location_id=source_location_id, context=context) self._make_production_line_procurement(cr, uid, line, shipment_move_id, context=context) - + for componant in production.bom_id.bom_lines: + if componant.product_id.type == 'service' and not production.move_lines or not production.move_lines2: + wf_service.trg_validate(uid, 'mrp.production', shipment_id, 'button_confirm', cr) wf_service.trg_validate(uid, 'stock.picking', shipment_id, 'button_confirm', cr) production.write({'state':'confirmed'}, context=context) return shipment_id