Merge lp:~therp-nl/banking-addons/ba61-fix_surplus_return into lp:banking-addons/6.1

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 171
Proposed branch: lp:~therp-nl/banking-addons/ba61-fix_surplus_return
Merge into: lp:banking-addons/6.1
Diff against target: 25 lines (+3/-1)
1 file modified
account_banking/banking_import_transaction.py (+3/-1)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/ba61-fix_surplus_return
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Review via email: mp+164808@code.launchpad.net

Description of the change

When creating a voucher in account_banking to use in the reconciliation of bank statement lines, the voucher line type should not depend on the sign of the booking that it is to be reconciled with, but on the sign of the bank statement line. Otherwise the voucher line can get the wrong sign in specific circumstances and the wrong move lines are being created.

Case: A sales invoice of €150 is paid with €200. The surplus amount of €50 is returned in a separate transaction. The two transactions together should be reconcilable with the original invoice.

To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_banking/banking_import_transaction.py'
2--- account_banking/banking_import_transaction.py 2013-05-20 08:07:48 +0000
3+++ account_banking/banking_import_transaction.py 2013-05-20 21:21:24 +0000
4@@ -468,10 +468,12 @@
5 journal = st_line.statement_id.journal_id
6 if st_line.amount < 0.0:
7 voucher_type = 'payment'
8+ voucher_line_type = 'dr'
9 account_id = (journal.default_debit_account_id and
10 journal.default_debit_account_id.id or False)
11 else:
12 voucher_type = 'receipt'
13+ voucher_line_type = 'cr'
14 account_id = (journal.default_credit_account_id and
15 journal.default_credit_account_id.id or False)
16
17@@ -533,7 +535,7 @@
18 'reconcile': True,
19 'amount': line_amount,
20 'account_id': transaction.move_line_id.account_id.id,
21- 'type': transaction.move_line_id.credit and 'dr' or 'cr',
22+ 'type': voucher_line_type,
23 }
24 voucher['line_ids'] = [(0, 0, vch_line)]
25 voucher_id = self.pool.get('account.voucher').create(

Subscribers

People subscribed via source and target branches