From e5be0142c4e4a8caaf79687a87089a10e781f98c Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 29 Jan 2010 19:57:43 +0530 Subject: [PATCH] [FIX] Account : wizard_pay_invoice corrected (Check made to calculate only receivable,payable lines) lp bug: https://launchpad.net/bugs/496889 fixed bzr revid: jvo@tinyerp.com-20100129142743-gkslge17jcfmewar --- addons/account/wizard/wizard_pay_invoice.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/account/wizard/wizard_pay_invoice.py b/addons/account/wizard/wizard_pay_invoice.py index bd0bacadd93..60e5a38ea4e 100644 --- a/addons/account/wizard/wizard_pay_invoice.py +++ b/addons/account/wizard/wizard_pay_invoice.py @@ -99,12 +99,12 @@ def _wo_check(self, cr, uid, data, context): # => Ask to a write-off of the difference. This could happen even if both amount are equal, # because if the currency rate # Get the amount in company currency for the invoice (according to move lines) - inv_amount_company_currency = invoice.move_id.amount -# for aml in invoice.move_id.line_id: -# if aml.account_id.id == invoice.account_id.id or aml.account_id.type in ('receivable', 'payable'): -# inv_amount_company_currency += aml.debit -# inv_amount_company_currency -= aml.credit -# inv_amount_company_currency = abs(inv_amount_company_currency) + inv_amount_company_currency = 0 + for aml in invoice.move_id.line_id: + if aml.account_id.id == invoice.account_id.id or aml.account_id.type in ('receivable', 'payable'): + inv_amount_company_currency += aml.debit + inv_amount_company_currency -= aml.credit + inv_amount_company_currency = abs(inv_amount_company_currency) # Get the current amount paid in company currency if journal.currency and invoice.company_id.currency_id.id<>journal.currency.id: