[FIX] account_voucher: fixed onchange_payment_rate_currency

bzr revid: qdp-launchpad@openerp.com-20111123164834-m4tjfjtxpp8j2iew
This commit is contained in:
Quentin (OpenERP) 2011-11-23 17:48:34 +01:00
parent d7827b9215
commit bc07877f64
2 changed files with 7 additions and 9 deletions

View File

@ -615,7 +615,7 @@ class account_voucher(osv.osv):
default['value']['writeoff_amount'] = self._compute_writeoff_amount(cr, uid, default['value']['line_dr_ids'], default['value']['line_cr_ids'], price)
return default
def onchange_payment_rate_currency(self, cr, uid, ids, currency_id, payment_rate_currency_id, date, amount, company_id, context=None):
def onchange_payment_rate_currency(self, cr, uid, ids, currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context=None):
if context is None:
context = {}
res = {'value': {}}
@ -623,8 +623,6 @@ class account_voucher(osv.osv):
if currency_id and currency_id == payment_rate_currency_id:
ctx = context.copy()
ctx.update({'date': date})
payment_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context=ctx).rate
res['value'].update({'payment_rate': payment_rate})
vals = self.onchange_rate(cr, uid, ids, payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context=ctx)
for key in vals.keys():
res[key].update(vals[key])

View File

@ -128,8 +128,8 @@
<separator string="Other Information" colspan="4"/>
<field name="currency_id" colspan="4"/>
<field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" groups='base.group_extended' colspan="3"/>
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1"/>
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4" on_change="onchange_payment_rate_currency(currency_id, payment_rate_currency_id, date, amount, company_id, context)"/>
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4"/>
<field name="number" colspan="4"/>
</group>
</page>
@ -208,8 +208,8 @@
<field name="exchange_acc_id"
domain="[('type','=','other')]" colspan="4"/>
<field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" groups='base.group_extended' colspan="3"/>
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1"/>
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4" on_change="onchange_payment_rate_currency(currency_id, payment_rate_currency_id, date, amount, company_id, context)"/>
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4"/>
</group>
<group col="2" colspan="1">
<separator string="Payment Options" colspan="2"/>
@ -362,8 +362,8 @@
<field name="exchange_acc_id"
domain="[('type','=','other')]" colspan="4"/>
<field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" groups='base.group_extended' colspan="3"/>
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1"/>
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4" on_change="onchange_payment_rate_currency(currency_id, payment_rate_currency_id, date, amount, company_id, context)"/>
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4"/>
</group>
<group col="2" colspan="1">
<separator string="Payment Options" colspan="2"/>