account: cancel move when canceling invoice
bzr revid: ced-d357568e0217d1dade984504755c7d7c8c70af42
This commit is contained in:
parent
7413ea7c01
commit
355f207837
|
@ -452,13 +452,15 @@ class account_invoice(osv.osv):
|
|||
return True
|
||||
|
||||
def action_cancel(self, cr, uid, ids, *args):
|
||||
account_move_obj = self.pool.get('account.move')
|
||||
invoices = self.read(cr, uid, ids, ['move_id'])
|
||||
for i in invoices:
|
||||
if i['move_id']:
|
||||
account_move_obj.button_cancel(cr, uid, [i['move_id'][0]])
|
||||
# delete the move this invoice was pointing to
|
||||
# Note that the corresponding move_lines and move_reconciles
|
||||
# will be automatically deleted too
|
||||
self.pool.get('account.move').unlink(cr, uid, [i['move_id'][0]])
|
||||
account_move_obj.unlink(cr, uid, [i['move_id'][0]])
|
||||
self.write(cr, uid, ids, {'state':'cancel', 'move_id':False})
|
||||
self._log_event(cr, uid, ids,-1.0, 'Cancel Invoice')
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue