[FIX] account_voucher: convertion rate of purchase receipt

The conversion of currencies in vouchers are made based on payment_rate_currency_id field (instead of usual currency_id).
This field was not present in the purchase view and not correctly set when we change the journal (and thus the currency) which was leading to rates of 1. With a rate of 1, the amount is equal to the currency amount (which is rarely correct). opw 611254
This commit is contained in:
Martin Trigaux 2014-09-22 12:16:46 +02:00
parent 9b87d6f371
commit ee4c67dc10
2 changed files with 2 additions and 1 deletions

View File

@ -918,7 +918,7 @@ class account_voucher(osv.osv):
currency_id = journal.currency.id
else:
currency_id = journal.company_id.currency_id.id
vals['value'].update({'currency_id': currency_id})
vals['value'].update({'currency_id': currency_id, 'payment_rate_currency_id': currency_id})
#in case we want to register the payment directly from an invoice, it's confusing to allow to switch the journal
#without seeing that the amount is expressed in the journal currency, and not in the invoice currency. So to avoid
#this common mistake, we simply reset the amount to 0 if the currency is not the invoice currency.

View File

@ -222,6 +222,7 @@
<field name="pay_now" invisible="1"/>
<field name="type" invisible="True"/>
<field name="payment_rate_currency_id" invisible="1"/>
<group>
<group>
<field name="partner_id" domain="[('supplier','=',True)]" string="Supplier" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" />