From 355f207837acb21fd7fadc41dfc70b5fbf645c4d Mon Sep 17 00:00:00 2001 From: ced <> Date: Mon, 9 Jul 2007 09:08:36 +0000 Subject: [PATCH] account: cancel move when canceling invoice bzr revid: ced-d357568e0217d1dade984504755c7d7c8c70af42 --- addons/account/invoice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 10b375b9141..c9ff521fd41 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -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