← Back to team overview

banking-addons-team team mailing list archive

lp:~therp-nl/banking-addons/6.1_fix_multiple_invoices_no_debit_move_cliep into lp:banking-addons

 

Holger Brunn (Therp) has proposed merging lp:~therp-nl/banking-addons/6.1_fix_multiple_invoices_no_debit_move_cliep into lp:banking-addons with lp:~therp-nl/banking-addons/6.1_fix_lacking_invoice_and_move_line as a prerequisite.

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

For more details, see:
https://code.launchpad.net/~therp-nl/banking-addons/6.1_fix_multiple_invoices_no_debit_move_cliep/+merge/154697
-- 
https://code.launchpad.net/~therp-nl/banking-addons/6.1_fix_multiple_invoices_no_debit_move_cliep/+merge/154697
Your team Banking Addons Team is requested to review the proposed merge of lp:~therp-nl/banking-addons/6.1_fix_multiple_invoices_no_debit_move_cliep into lp:banking-addons.
=== modified file 'account_banking/banking_import_transaction.py'
--- account_banking/banking_import_transaction.py	2013-02-07 09:56:06 +0000
+++ account_banking/banking_import_transaction.py	2013-03-21 13:31:59 +0000
@@ -140,7 +140,8 @@
             limit=0, context=context)
         orders = payment_order_obj.browse(cr, uid, order_ids, context)
         candidates = [x for x in orders if
-                      is_zero(x.total - trans.transferred_amount)]
+                      is_zero(x.total - trans.transferred_amount) and
+                      x.line_ids and x.line_ids[0].debit_move_line_id]
         if len(candidates) > 0:
             # retrieve the common account_id, if any
             account_id = False
@@ -374,7 +375,7 @@
                 move_line = False
                 partial = False
 
-            elif len(candidates) == 1:
+            elif len(candidates) == 1 and candidates[0].invoice:
                 # Mismatch in amounts
                 move_line = candidates[0]
                 invoice = move_line.invoice
@@ -422,10 +423,10 @@
                     if x.partner_id.id == move_line.partner_id.id
                     ]
                 
-            return (trans, self._get_move_info(
-                    cr, uid, [move_line.id],
-                    account_ids and account_ids[0] or False),
-                    trans2)
+                return (trans, self._get_move_info(
+                        cr, uid, [move_line.id],
+                        account_ids and account_ids[0] or False),
+                        trans2)
 
         return trans, False, False
 
@@ -1056,7 +1057,7 @@
         if move_lines and len(move_lines) == 1:
             retval['reference'] = move_lines[0].ref
         if retval['match_type'] == 'invoice':
-            retval['invoice_ids'] = [x.invoice.id for x in move_lines]
+            retval['invoice_ids'] = list(set([x.invoice.id for x in move_lines]))
             retval['type'] = type_map[move_lines[0].invoice.type]
         return retval
     

=== modified file 'account_banking_nl_clieop/wizard/clieop.py'
--- account_banking_nl_clieop/wizard/clieop.py	2013-01-28 10:19:32 +0000
+++ account_banking_nl_clieop/wizard/clieop.py	2013-03-21 13:31:59 +0000
@@ -43,6 +43,11 @@
     #def format(self, value):
     #    return convert.to_swift(super(SWIFTField, self).format(value))
 
+class SWIFTFieldNoLeadingWhitespace(SWIFTField):
+    def format(self, value):
+        return super(SWIFTFieldNoLeadingWhitespace, self).format(
+            self.cast(value).lstrip())
+
 def eleven_test(s):
     '''
     Dutch eleven-test for validating 9-long local bank account numbers.
@@ -161,7 +166,7 @@
     _fields = [
         record.Filler('recordcode', 4, '0150'),
         record.Filler('variantcode', 1, 'A'),
-        SWIFTField('paymentreference', 16),
+        SWIFTFieldNoLeadingWhitespace('paymentreference', 16),
         record.Filler('filler', 29),
     ]
 


Follow ups