← Back to team overview

clearcorp team mailing list archive

[Branch ~banking-addons-team/banking-addons/6.1] Rev 157: [FIX] Make sure the invoice number is used as direct debit order line reference

 

Merge authors:
  Stefan Rijnhart (Therp) (stefan-therp)
Related merge proposals:
  https://code.launchpad.net/~therp-nl/banking-addons/ba61-lp1102619_use_invoice_number_as_debit_order_line_reference/+merge/144180
  proposed by: Stefan Rijnhart (Therp) (stefan-therp)
  review: Approve - Guewen Baconnier @ Camptocamp (gbaconnier-c2c)
------------------------------------------------------------
revno: 157 [merge]
author: Stefan Rijnhart <stefan@xxxxxxxx>
committer: Guewen Baconnier <guewen.baconnier@xxxxxxxxxxxxxx>
branch nick: banking-addons
timestamp: Mon 2013-01-28 10:44:24 +0100
message:
  [FIX] Make sure the invoice number is used as direct debit order line reference
modified:
  account_banking/wizard/account_payment_order.py


--
lp:banking-addons
https://code.launchpad.net/~banking-addons-team/banking-addons/6.1

Your team CLEARCORP development team is subscribed to branch lp:banking-addons.
To unsubscribe from this branch go to https://code.launchpad.net/~banking-addons-team/banking-addons/6.1/+edit-subscription
=== modified file 'account_banking/wizard/account_payment_order.py'
--- account_banking/wizard/account_payment_order.py	2013-01-10 13:38:19 +0000
+++ account_banking/wizard/account_payment_order.py	2013-01-21 20:25:00 +0000
@@ -85,12 +85,20 @@
             state = communication2 = False
             communication = line.ref or '/'
             if line.invoice:
-                if line.invoice.reference_type == 'structured':
+                if line.invoice.type in ('in_invoice', 'in_refund'):
+                    if line.invoice.reference_type == 'structured':
+                        state = 'structured'
+                        communication = line.invoice.reference
+                    else:
+                        state = 'normal'
+                        communication2 = line.invoice.reference
+                else:
+                    # Make sure that the communication includes the
+                    # customer invoice number (in the case of debit order)
+                    communication = line.invoice.number.replace('/', '')
                     state = 'structured'
-                    communication = line.invoice.reference
-                else:
-                    state = 'normal'
-                    communication2 = line.invoice.reference
+                    if communication != line.ref:
+                        communication2 = line.ref
             # support debit orders when enabled
             if (payment.payment_order_type == 'debit' and
                 'amount_to_receive' in line):