From 177ca871c9a220543bbe2012f95339a679b8c27a Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 11 Oct 2011 16:47:44 +0200 Subject: [PATCH] [FIX] account_voucher: amount currency in voucher entries bzr revid: qdp-launchpad@openerp.com-20111011144744-pqf9tth1p1osh8wt --- addons/account/account_move_line.py | 2 +- addons/account_voucher/account_voucher.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 92d71339168..e105765a31c 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1259,7 +1259,7 @@ class account_move_line(osv.osv): break # Automatically convert in the account's secondary currency if there is one and # the provided values were not already multi-currency - if account.currency_id and not vals.get('ammount_currency') and account.currency_id.id != account.company_id.currency_id.id: + if account.currency_id and (vals.get('amount_currency', False) is False) and account.currency_id.id != account.company_id.currency_id.id: vals['currency_id'] = account.currency_id.id ctx = {} if 'date' in vals: diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 005e5d9ab46..b4d354c4b43 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -781,7 +781,7 @@ class account_voucher(osv.osv): if not (tax_data.base_code_id and tax_data.tax_code_id): raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to configure account base code and account tax code on the '%s' tax!") % (tax_data.name)) sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1 - move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0 + move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or False voucher_line = move_line_pool.create(cr, uid, move_line) rec_ids = [voucher_line, line.move_line_id.id] @@ -843,8 +843,8 @@ class account_voucher(osv.osv): 'date': inv.date, 'credit': diff > 0 and diff or 0.0, 'debit': diff < 0 and -diff or 0.0, - #'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0, - #'currency_id': company_currency <> current_currency and current_currency or False, + 'amount_currency': company_currency <> current_currency and inv.writeoff_amount or False, + 'currency_id': company_currency <> current_currency and current_currency or False, } move_line_pool.create(cr, uid, move_line) self.write(cr, uid, [inv.id], {