← Back to team overview

banking-addons-team team mailing list archive

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

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/banking-addons/ba61-fix_surplus_return into lp:banking-addons.

Requested reviews:
  Banking Addons Team (banking-addons-team)

For more details, see:
https://code.launchpad.net/~therp-nl/banking-addons/ba61-fix_surplus_return/+merge/164808

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 gets the wrong sign 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.

-- 
https://code.launchpad.net/~therp-nl/banking-addons/ba61-fix_surplus_return/+merge/164808
Your team Banking Addons Team is requested to review the proposed merge of lp:~therp-nl/banking-addons/ba61-fix_surplus_return into lp:banking-addons.
=== 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 @@
         journal = st_line.statement_id.journal_id
         if st_line.amount < 0.0:
             voucher_type = 'payment'
+            voucher_line_type = 'dr'
             account_id = (journal.default_debit_account_id and
                           journal.default_debit_account_id.id or False)
         else:
             voucher_type = 'receipt'
+            voucher_line_type = 'cr'
             account_id = (journal.default_credit_account_id and
                           journal.default_credit_account_id.id or False)
 
@@ -533,7 +535,7 @@
             'reconcile': True,
             'amount': line_amount,
             'account_id': transaction.move_line_id.account_id.id,
-            'type': transaction.move_line_id.credit and 'dr' or 'cr',
+            'type': voucher_line_type,
             }
         voucher['line_ids'] = [(0, 0, vch_line)]
         voucher_id = self.pool.get('account.voucher').create(


Follow ups