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
=== modified file 'account_banking/banking_import_transaction.py'
--- account_banking/banking_import_transaction.py 2013-05-20 08:07:48 +0000
+++ account_banking/banking_import_transaction.py 2013-05-20 21:21:24 +0000
@@ -468,10 +468,12 @@
468 journal = st_line.statement_id.journal_id468 journal = st_line.statement_id.journal_id
469 if st_line.amount < 0.0:469 if st_line.amount < 0.0:
470 voucher_type = 'payment'470 voucher_type = 'payment'
471 voucher_line_type = 'dr'
471 account_id = (journal.default_debit_account_id and472 account_id = (journal.default_debit_account_id and
472 journal.default_debit_account_id.id or False)473 journal.default_debit_account_id.id or False)
473 else:474 else:
474 voucher_type = 'receipt'475 voucher_type = 'receipt'
476 voucher_line_type = 'cr'
475 account_id = (journal.default_credit_account_id and477 account_id = (journal.default_credit_account_id and
476 journal.default_credit_account_id.id or False)478 journal.default_credit_account_id.id or False)
477479
@@ -533,7 +535,7 @@
533 'reconcile': True,535 'reconcile': True,
534 'amount': line_amount,536 'amount': line_amount,
535 'account_id': transaction.move_line_id.account_id.id,537 'account_id': transaction.move_line_id.account_id.id,
536 'type': transaction.move_line_id.credit and 'dr' or 'cr',538 'type': voucher_line_type,
537 }539 }
538 voucher['line_ids'] = [(0, 0, vch_line)]540 voucher['line_ids'] = [(0, 0, vch_line)]
539 voucher_id = self.pool.get('account.voucher').create(541 voucher_id = self.pool.get('account.voucher').create(

Subscribers

People subscribed via source and target branches