From 65e02c0c81686583e4bb8e4907c7d46ba9fe7b79 Mon Sep 17 00:00:00 2001 From: Rifakat Date: Thu, 12 Jul 2012 14:45:55 +0530 Subject: [PATCH] [FIX] account: fix the residual amount computation while move line entries through manual reconciliation bzr revid: rha@tinyerp.com-20120712091555-34d390vpbphtflmr --- addons/account/account_invoice.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index bbb002c232e..14fd7c13fec 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -93,11 +93,17 @@ class account_invoice(osv.osv): def _amount_residual(self, cr, uid, ids, name, args, context=None): result = {} for invoice in self.browse(cr, uid, ids, context=context): + checked_partial_rec_ids = [] result[invoice.id] = 0.0 if invoice.move_id: - for m in invoice.move_id.line_id: - if m.account_id.type in ('receivable','payable'): - result[invoice.id] += m.amount_residual_currency + for move_line in invoice.move_id.line_id: + if move_line.account_id.type in ('receivable','payable'): + if move_line.reconcile_partial_id: + partial_reconcile_id = move_line.reconcile_partial_id.id + if partial_reconcile_id in checked_partial_rec_ids: + continue + checked_partial_rec_ids.append(partial_reconcile_id) + result[invoice.id] += move_line.amount_residual_currency return result # Give Journal Items related to the payment reconciled to this invoice