From 91bf62ce7c50c1caee1e2e88fe7cc5449cf83428 Mon Sep 17 00:00:00 2001 From: "Vra,Jay" <> Date: Tue, 6 Jul 2010 20:40:22 +0530 Subject: [PATCH] [FIX] Account : When Payment is done by bank statement with a different currency, amount should be converted to company currency bzr revid: jvo@tinyerp.com-20100706151022-3b3gvzht4ihpceh2 --- .../wizard/account_statement_from_invoice.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/account/wizard/account_statement_from_invoice.py b/addons/account/wizard/account_statement_from_invoice.py index 00462e8fb26..c216fc88a6a 100644 --- a/addons/account/wizard/account_statement_from_invoice.py +++ b/addons/account/wizard/account_statement_from_invoice.py @@ -58,14 +58,19 @@ class account_statement_from_invoice_lines(osv.osv_memory): # else: ctx['date'] = line_date amount = 0.0 + + if line.debit > 0: + amount = line.debit + elif line.credit > 0: + amount = -line.credit + if line.amount_currency: - amount = currency_obj.compute(cr, uid, line.currency_id.id, + amount = currency_obj.compute(cursor, user, line.currency_id.id, statement.currency.id, line.amount_currency, context=ctx) - else: - if line.debit > 0: - amount=line.debit - elif line.credit > 0: - amount=-line.credit + elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id): + amount = currency_obj.compute(cursor, user, line.invoice.currency_id.id, + statement.currency.id, amount, context=ctx) + reconcile_id = statement_reconcile_obj.create(cr, uid, { 'line_ids': [(6, 0, [line.id])] }, context=context)