Merge lp:~openerp-dev/openobject-addons/7.0-opw-596883-dhr into lp:openobject-addons/7.0

Proposed by Dharti Ratani(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-596883-dhr
Merge into: lp:openobject-addons/7.0
Diff against target: 25 lines (+5/-3)
1 file modified
account_voucher/account_voucher.py (+5/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-596883-dhr
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+183402@code.launchpad.net

Description of the change

Hello Sir,

Fixed the issue of an extra questioned entry generated while paying invoice and refund in a foreign currency.

Steps to produce :

Set home currency as EUR in a new db with demo data.

1. Create a new Debtors account with secondary currency - USD.
2. Create and validate a customer invoice in USD (e.g. USD 5,000) and
choose the Debtors account in USD.
Invoice date is 1 Jan 2013 and the exchange rate is 1.28.
3. Create and validate a customer refund in USD (e.g. USD 1,000) and
choose the Debtors account in USD.
Invoice date is 6 Jun 2013 and the exchange rate is 1.53.
4. Create a customer payment in USD (e.g. USD 4,000). And then
reconcile the invoice, payment and credit note.
5. A questioned entry is generated.

Incorrect balance of credit note is resulted.

Thanks
dhr

To post a comment you must log in.

Unmerged revisions

9399. By Dharti Ratani(OpenERP)

[FIX]Fixed for the wrong entries generated while reconciling a invoice and refund in foreign currency through payment

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 2013-08-21 12:17:14 +0000
3+++ account_voucher/account_voucher.py 2013-09-02 09:20:07 +0000
4@@ -786,7 +786,7 @@
5 if line.amount_residual_currency == price:
6 move_line_found = line.id
7 break
8- total_credit += line.credit and line.amount_currency or 0.0
9+ total_credit += line.credit and abs(line.amount_currency) or 0.0
10 total_debit += line.debit and line.amount_currency or 0.0
11
12 #voucher line creation
13@@ -1269,8 +1269,10 @@
14 amount_currency = currency_obj.compute(cr, uid, company_currency, line.move_line_id.currency_id.id, move_line['debit']-move_line['credit'], context=ctx)
15 if line.amount == line.amount_unreconciled:
16 sign = voucher.type in ('payment', 'purchase') and -1 or 1
17- foreign_currency_diff = sign * line.move_line_id.amount_residual_currency + amount_currency
18-
19+ if line.type=='dr':
20+ foreign_currency_diff = sign * (line.move_line_id.amount_residual_currency - amount_currency)
21+ else:
22+ foreign_currency_diff = sign * (line.move_line_id.amount_residual_currency + amount_currency)
23 move_line['amount_currency'] = amount_currency
24 voucher_line = move_line_obj.create(cr, uid, move_line)
25 rec_ids = [voucher_line, line.move_line_id.id]