From ef6a454dbb85c07820da0e419a3ca60e92cd903b Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 22 Aug 2011 12:02:14 +0200 Subject: [PATCH] [FIX] account_voucher: fixed writeoff amount method to compute correct values under multi-currency scenario bzr revid: qdp-launchpad@openerp.com-20110822100214-exxx5xigufvrppdu --- addons/account_voucher/account_voucher.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 17940aa6f25..2168cd31add 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -182,15 +182,11 @@ class account_voucher(osv.osv): ctx.update({'date': voucher.date}) for l in voucher.line_dr_ids: real_amount -= l.amount_in_company_currency - counter_for_writeoff -= (l.voucher_currency_id.id == l.company_currency_id.id) and l.amount_in_company_currency or l.amount_in_voucher_currency - #ctx.update({'date': l.date_original}) - #counter_for_writeoff -= currency_pool.compute(cr, uid, voucher.company_id.currency_id.id, voucher.currency_id.id, l.amount_in_company_currency, context=ctx) + counter_for_writeoff -= (l.voucher_currency_id.id == l.currency_id.id) and l.amount or l.amount_in_voucher_currency counter_for_currency_diff -= currency_pool.compute(cr, uid, l.currency_id.id, voucher.company_id.currency_id.id, l.amount, context=ctx) for l in voucher.line_cr_ids: real_amount += l.amount_in_company_currency - counter_for_writeoff += (l.voucher_currency_id.id == l.company_currency_id.id) and l.amount_in_company_currency or l.amount_in_voucher_currency - #ctx.update({'date': l.date_original}) - #counter_for_writeoff += currency_pool.compute(cr, uid, voucher.company_id.currency_id.id, voucher.currency_id.id, l.amount_in_company_currency, context=ctx) + counter_for_writeoff += (l.voucher_currency_id.id == l.currency_id.id) and l.amount or l.amount_in_voucher_currency counter_for_currency_diff += currency_pool.compute(cr, uid, l.currency_id.id, voucher.company_id.currency_id.id, l.amount, context=ctx) writeoff_amount = voucher.amount - counter_for_writeoff res[voucher.id]['writeoff_amount'] = writeoff_amount