[FIX] Stock : Removal of picking shuold affect product stock

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

bzr revid: jvo@tinyerp.com-20091202071524-csct9ktra6u9ytgw
This commit is contained in:
VRA(OpenERP) 2009-12-02 12:45:24 +05:30 committed by Jay (Open ERP)
parent 0b44aff80b
commit 5eb3b61c14
1 changed files with 11 additions and 0 deletions

View File

@ -784,6 +784,17 @@ class stock_picking(osv.osv):
if move.state not in ('cancel',):
return False
return True
def unlink(self, cr, uid, ids, context=None):
for pick in self.browse(cr, uid, ids, context=context):
if pick.state in ['done','cancel']:
raise osv.except_osv(_('Error'), _('You cannot remove the picking which is in %s state !')%(pick.state,))
elif pick.state in ['confirmed','assigned']:
ids2 = [move.id for move in pick.move_lines]
self.pool.get('stock.move').action_cancel(cr, uid, ids2, context)
else:
continue
return super(stock_picking, self).unlink(cr, uid, ids, context=context)
stock_picking()