[IMP] Improve code when bom componant is service stock move in available state
bzr revid: jap@tinyerp.com-20130515125745-da9sybl7osixzhfm
This commit is contained in:
parent
ac5d49daa1
commit
8f1393f3ca
|
@ -647,6 +647,8 @@ class mrp_production(osv.osv):
|
|||
|
||||
for (production_id,name) in self.name_get(cr, uid, ids):
|
||||
production = self.browse(cr, uid, production_id)
|
||||
if not production.move_prod_id and not production.move_lines:
|
||||
move_obj.write(cr, uid, [i.id for i in production.move_created_ids], {'state': 'assigned'})
|
||||
if production.move_prod_id and production.move_prod_id.location_id.id != production.location_dest_id.id:
|
||||
move_obj.write(cr, uid, [production.move_prod_id.id],
|
||||
{'location_id': production.location_dest_id.id})
|
||||
|
@ -775,9 +777,6 @@ class mrp_production(osv.osv):
|
|||
for new_parent_id in new_parent_ids:
|
||||
stock_mov_obj.write(cr, uid, [raw_product.id], {'move_history_ids': [(4,new_parent_id)]})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for componant in production.bom_id.bom_lines:
|
||||
if componant.product_id.type == 'service' and not production.move_lines and not production.move_lines2:
|
||||
wf_service.trg_validate(uid, 'mrp.production', production_id, 'button_produce', cr)
|
||||
wf_service.trg_validate(uid, 'mrp.production', production_id, 'button_produce_done', cr)
|
||||
return True
|
||||
|
||||
|
|
|
@ -72,6 +72,14 @@
|
|||
<field name="signal"></field>
|
||||
<field name="condition">picking_id and picking_id.state=='done'</field>
|
||||
</record>
|
||||
|
||||
<record id="prod_trans_in_production_done_jap_final" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_ready"/>
|
||||
<field name="act_to" ref="prod_act_done"/>
|
||||
<field name="signal">button_produce_done</field>
|
||||
<field name="condition">not move_lines and test_production_done()</field>
|
||||
</record>
|
||||
|
||||
<record id="prod_trans_ready_in_production" model="workflow.transition">
|
||||
<field name="act_from" ref="prod_act_ready"/>
|
||||
<field name="act_to" ref="prod_act_in_production"/>
|
||||
|
|
|
@ -158,6 +158,8 @@ class StockMove(osv.osv):
|
|||
product_data = production_obj.browse(cr, uid, production_ids[0])
|
||||
if product_data.move_created_ids2 and product_data.move_lines2 and move.state=='done':
|
||||
wf_service.trg_validate(uid, 'mrp.production', product_data.id, 'button_produce_done', cr)
|
||||
elif not product_data.move_lines2 and move.state=='done':
|
||||
wf_service.trg_validate(uid, 'mrp.production', product_data.id, 'button_produce_done', cr)
|
||||
return res
|
||||
|
||||
StockMove()
|
||||
|
|
Loading…
Reference in New Issue