[FIX] Sale: called the button_check() method of procurement workflow to cancel procurement

lp bug: https://launchpad.net/bugs/588220 fixed

bzr revid: mtr@mtr-20101217110351-hj8p28v4vjyupebb
This commit is contained in:
mtr 2010-12-17 16:33:51 +05:30
parent 0f29cf69e8
commit ead299414f
1 changed files with 5 additions and 0 deletions

View File

@ -565,6 +565,11 @@ class sale_order(osv.osv):
raise osv.except_osv(
_('Could not cancel sales order !'),
_('You must first cancel all picking attached to this sales order.'))
for mov in pick.move_lines:
proc_ids = self.pool.get('procurement.order').search(cr, uid, [('move_id', '=', mov.id)])
if proc_ids:
for proc in proc_ids:
wf_service.trg_validate(uid, 'procurement.order', proc, 'button_check', cr)
for r in self.read(cr, uid, ids, ['picking_ids']):
for pick in r['picking_ids']:
wf_service.trg_validate(uid, 'stock.picking', pick, 'button_cancel', cr)