[FIX] account_voucher: fixed onchange_payment_rate_currency
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Wed, 23 Nov 2011 16:48:34 +0000 (17:48 +0100)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Wed, 23 Nov 2011 16:48:34 +0000 (17:48 +0100)
bzr revid: qdp-launchpad@openerp.com-20111123164834-m4tjfjtxpp8j2iew

addons/account_voucher/account_voucher.py
addons/account_voucher/voucher_payment_receipt_view.xml

index e47038d..b759387 100644 (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])
index 17216ed..4b6817d 100644 (file)
                                 <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>
                                     <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"/>
                                     <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"/>