Disable deleting move line not in state draft

bzr revid: ced-f92a14e31023b6a8818f70d9d4096db36f112a36
This commit is contained in:
ced 2007-12-31 13:31:32 +00:00
parent 932f6fe46e
commit 5516c6e7f5
1 changed files with 9 additions and 0 deletions

View File

@ -963,6 +963,15 @@ class stock_move(osv.osv):
wf_service.trg_trigger(uid, 'stock.move', id, cr)
return True
def unlink(self, cr, uid, ids, context=None):
for move in self.browse(cr, uid, ids, context=context):
if move.state != 'draft':
raise osv.except_osv('UserError',
'You can only delete draft moves.')
return super(stock_move, self).unlink(
cr, uid, ids, context=context)
stock_move()
class stock_inventory(osv.osv):