[FIX] account_voucher: amount currency in voucher entries

bzr revid: qdp-launchpad@openerp.com-20111011144744-pqf9tth1p1osh8wt
This commit is contained in:
Quentin (OpenERP) 2011-10-11 16:47:44 +02:00
parent 4ece4f2d3c
commit 177ca871c9
2 changed files with 4 additions and 4 deletions

View File

@ -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:

View File

@ -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], {