ACCOUNT: improve error message on cancel invoice

bzr revid: ced-3130281f2a5a3e09d5b63ff596401d0e15e549ac
This commit is contained in:
ced
2007-06-11 05:46:57 +00:00
parent c747cbe9a0
commit 62efbb069a
+2
View File
@@ -618,6 +618,8 @@ class account_move(osv.osv):
def unlink(self, cr, uid, ids, context={}, check=True):
toremove = []
for move in self.browse(cr, uid, ids, context):
if move['state'] <> 'draft':
raise osv.except_osv('Error', 'You must first cancel the invoice movement: %s !' % move['name'])
line_ids = map(lambda x: x.id, move.line_id)
context['journal_id'] = move.journal_id.id
context['period_id'] = move.period_id.id