[IMP] stock_location : mrp.procurement object is replaced with procurement.order
bzr revid: mtr@mtr-20100528123709-1p6051bhqb7z0e7x
This commit is contained in:
parent
fad0827350
commit
826f384cf8
|
@ -37,7 +37,7 @@ This module may be useful for different purposes:
|
|||
* Manage products to be rent.
|
||||
""",
|
||||
'author': 'Tiny',
|
||||
'depends': ['mrp','stock'],
|
||||
'depends': ['procurement','stock'],
|
||||
'init_xml': [],
|
||||
'update_xml': ['stock_view.xml', 'security/ir.model.access.csv', 'mrp_pull_workflow.xml'],
|
||||
'demo_xml': [],
|
||||
|
|
|
@ -27,22 +27,22 @@ from mx import DateTime
|
|||
import time
|
||||
from tools.translate import _
|
||||
|
||||
class mrp_procurement(osv.osv):
|
||||
_inherit = 'mrp.procurement'
|
||||
class procurement_order(osv.osv):
|
||||
_inherit = 'procurement.order'
|
||||
def check_buy(self, cr, uid, ids, context=None):
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
for line in procurement.product_id.flow_pull_ids:
|
||||
print line.location_src_id.name, line.location_id.name, line.type_proc
|
||||
if line.location_id==procurement.location_id:
|
||||
return line.type_proc=='buy'
|
||||
return super(mrp_procurement, self).check_buy(cr, uid, ids)
|
||||
return super(procurement_order, self).check_buy(cr, uid, ids)
|
||||
|
||||
def check_produce(self, cr, uid, ids, context=None):
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
for line in procurement.product_id.flow_pull_ids:
|
||||
if line.location_id==procurement.location_id:
|
||||
return line.type_proc=='produce'
|
||||
return super(mrp_procurement, self).check_produce(cr, uid, ids)
|
||||
return super(procurement_order, self).check_produce(cr, uid, ids)
|
||||
|
||||
def check_move(self, cr, uid, ids, context=None):
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
|
@ -54,7 +54,7 @@ class mrp_procurement(osv.osv):
|
|||
return False
|
||||
|
||||
def action_move_create(self, cr, uid, ids,context=None):
|
||||
proc_obj = self.pool.get('mrp.procurement')
|
||||
proc_obj = self.pool.get('procurement.order')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
location_obj = self.pool.get('stock.location')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
@ -100,7 +100,7 @@ class mrp_procurement(osv.osv):
|
|||
self.pool.get('stock.move').write(cr,uid, [proc.move_id.id], {
|
||||
'state':'waiting'
|
||||
}, context=context)
|
||||
proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
|
||||
proc_id = self.pool.get('procurement.order').create(cr, uid, {
|
||||
'name': line.name,
|
||||
'origin': origin,
|
||||
'company_id': line.company_id and line.company_id.id or False,
|
||||
|
@ -118,7 +118,7 @@ class mrp_procurement(osv.osv):
|
|||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
|
||||
if proc.move_id:
|
||||
self.pool.get('stock.move').write(cr, uid, [proc.move_id.id],
|
||||
{'location_id':proc.location_id.id})
|
||||
|
@ -128,4 +128,4 @@ class mrp_procurement(osv.osv):
|
|||
return False
|
||||
|
||||
|
||||
mrp_procurement()
|
||||
procurement_order()
|
||||
|
|
|
@ -4,20 +4,20 @@
|
|||
<!-- Production -->
|
||||
|
||||
<record id="act_move" model="workflow.activity">
|
||||
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
|
||||
<field name="wkf_id" ref="procurement.wkf_procurement"/>
|
||||
<field name="name">move</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_move_create()</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_confirm_mto_buy01" model="workflow.transition">
|
||||
<field name="act_from" ref="mrp_procurement.act_confirm_mto"/>
|
||||
<field name="act_from" ref="procurement.act_confirm_mto"/>
|
||||
<field name="act_to" ref="act_move"/>
|
||||
<field name="condition">check_move()</field>
|
||||
</record>
|
||||
<record id="trans_confirm_mto_buy02" model="workflow.transition">
|
||||
<field name="act_from" ref="act_move"/>
|
||||
<field name="act_to" ref="mrp_procurement.act_make_done"/>
|
||||
<field name="act_to" ref="procurement.act_make_done"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue