Somesh Khare(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-574440-skh into
lp:openobject-addons/6.1.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574440-skh/+merge/106955
Hello Sir,
[Fix] : exchange rate calculation is not working if company currency isn't rate
1
Kindly review the branch and please share your views on it.
Thanks & Regards,
Somesh Khare
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574440-skh/+merge/106955
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-574440-skh.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py 2012-03-30 11:07:16 +0000
+++ account_voucher/account_voucher.py 2012-05-23 07:48:21 +0000
@@ -231,14 +231,14 @@
for voucher in self.browse(cr, uid, ids, context=context):
if voucher.currency_id:
if voucher.company_id.currency_id.id == voucher.payment_rate_currency_id.id:
- rate = 1 / voucher.payment_rate
+ rate = voucher.payment_rate
else:
ctx = context.copy()
ctx.update({'date': voucher.date})
voucher_rate = self.browse(cr, uid, voucher.id, context=ctx).currency_id.rate
company_currency_rate = voucher.company_id.currency_id.rate
- rate = voucher_rate * company_currency_rate
- res[voucher.id] = voucher.amount / rate
+ rate = company_currency_rate / voucher_rate
+ res[voucher.id] = voucher.amount * rate
return res
_name = 'account.voucher'
@@ -1076,7 +1076,8 @@
elif line.move_line_id.currency_id.id == voucher_brw.payment_rate_currency_id.id:
# if the rate is specified on the voucher, we must use it
voucher_rate = currency_obj.browse(cr, uid, voucher_currency, context=ctx).rate
- amount_currency = (move_line['debit'] - move_line['credit']) * voucher_brw.payment_rate * voucher_rate
+ amount_currency = currency_obj.compute(cr, uid, voucher_brw.company_id.currency_id.id, voucher_brw.currency_id.id, (move_line['debit'] - move_line['credit']), context=context)
+ amount_currency = amount_currency * voucher_brw.payment_rate
else:
# otherwise we use the rates of the system (giving the voucher date in the context)
amount_currency = currency_obj.compute(cr, uid, company_currency, line.move_line_id.currency_id.id, move_line['debit']-move_line['credit'], context=ctx)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp