Merge lp:~openerp-dev/openobject-addons/6.1-opw-574440-skh into lp:openobject-addons/6.1

Proposed by Somesh Khare
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-574440-skh
Merge into: lp:openobject-addons/6.1
Diff against target: 31 lines (+5/-4)
1 file modified
account_voucher/account_voucher.py (+5/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-574440-skh
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+106955@code.launchpad.net

Description of the change

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

To post a comment you must log in.
6807. By Carlos Vásquez (CLEARCORP)

[FIX]account.voucher.py: exchange rate calculation is not working if company currency isn't rate 1(Case: ref 574440)

Unmerged revisions

6807. By Carlos Vásquez (CLEARCORP)

[FIX]account.voucher.py: exchange rate calculation is not working if company currency isn't rate 1(Case: ref 574440)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_voucher/account_voucher.py'
2--- account_voucher/account_voucher.py 2012-03-30 11:07:16 +0000
3+++ account_voucher/account_voucher.py 2012-05-24 07:33:19 +0000
4@@ -231,14 +231,14 @@
5 for voucher in self.browse(cr, uid, ids, context=context):
6 if voucher.currency_id:
7 if voucher.company_id.currency_id.id == voucher.payment_rate_currency_id.id:
8- rate = 1 / voucher.payment_rate
9+ rate = voucher.payment_rate
10 else:
11 ctx = context.copy()
12 ctx.update({'date': voucher.date})
13 voucher_rate = self.browse(cr, uid, voucher.id, context=ctx).currency_id.rate
14 company_currency_rate = voucher.company_id.currency_id.rate
15- rate = voucher_rate * company_currency_rate
16- res[voucher.id] = voucher.amount / rate
17+ rate = company_currency_rate / voucher_rate
18+ res[voucher.id] = voucher.amount * rate
19 return res
20
21 _name = 'account.voucher'
22@@ -1076,7 +1076,8 @@
23 elif line.move_line_id.currency_id.id == voucher_brw.payment_rate_currency_id.id:
24 # if the rate is specified on the voucher, we must use it
25 voucher_rate = currency_obj.browse(cr, uid, voucher_currency, context=ctx).rate
26- amount_currency = (move_line['debit'] - move_line['credit']) * voucher_brw.payment_rate * voucher_rate
27+ 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)
28+ amount_currency = amount_currency * voucher_brw.payment_rate
29 else:
30 # otherwise we use the rates of the system (giving the voucher date in the context)
31 amount_currency = currency_obj.compute(cr, uid, company_currency, line.move_line_id.currency_id.id, move_line['debit']-move_line['credit'], context=ctx)