← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~therp-nl/banking-addons/ba7.0-MIG-recent_fixes into lp:banking-addons/banking-addons-70

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/banking-addons/ba7.0-MIG-recent_fixes into lp:banking-addons/banking-addons-70 with lp:~therp-nl/banking-addons/7.0-link_partner_wizard as a prerequisite.

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

For more details, see:
https://code.launchpad.net/~therp-nl/banking-addons/ba7.0-MIG-recent_fixes/+merge/161833

[MIG] Forward ported fixes of 6.1 branch
-- 
https://code.launchpad.net/~therp-nl/banking-addons/ba7.0-MIG-recent_fixes/+merge/161833
Your team Banking Addons Team is requested to review the proposed merge of lp:~therp-nl/banking-addons/ba7.0-MIG-recent_fixes into lp:banking-addons/banking-addons-70.
=== modified file 'account_banking/banking_import_transaction.py'
--- account_banking/banking_import_transaction.py	2013-05-01 14:46:34 +0000
+++ account_banking/banking_import_transaction.py	2013-05-01 14:46:34 +0000
@@ -181,7 +181,7 @@
             Match on ID of invoice (reference, name or number, whatever
             available and sensible)
             '''
-            if invoice.reference:
+            if invoice.reference and len(invoice.reference) > 2:
                 # Reference always comes first, as it is manually set for a
                 # reason.
                 iref = invoice.reference.upper()
@@ -189,7 +189,7 @@
                     return True
             if invoice.type.startswith('in_'):
                 # Internal numbering, no likely match on number
-                if invoice.name:
+                if invoice.name and len(invoice.name) > 2:
                     iname = invoice.name.upper()
                     if iname in ref or iname in msg:
                         return True
@@ -334,7 +334,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
@@ -382,10 +382,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
 
@@ -791,7 +791,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_abnamro/abnamro.py'
--- account_banking_nl_abnamro/abnamro.py	2013-05-01 14:46:34 +0000
+++ account_banking_nl_abnamro/abnamro.py	2013-05-01 14:46:34 +0000
@@ -295,7 +295,7 @@
                 if fields[2].startswith('/'):
                     self.remote_account = fields[2][1:].strip()
                 else:
-                    self.message += ' ' + fields[2].strip()
+                    self.remote_account = fields[2].strip()
                 # fourth column contains remote owner
                 self.remote_owner = (len(fields) > 3 and fields[3].strip() or
                                      False)

=== modified file 'account_banking_nl_clieop/wizard/clieop.py'
--- account_banking_nl_clieop/wizard/clieop.py	2013-05-01 14:46:34 +0000
+++ account_banking_nl_clieop/wizard/clieop.py	2013-05-01 14:46:34 +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),
     ]
 

=== modified file 'account_banking_payment/model/banking_import_transaction.py'
--- account_banking_payment/model/banking_import_transaction.py	2013-05-01 14:46:34 +0000
+++ account_banking_payment/model/banking_import_transaction.py	2013-05-01 14:46:34 +0000
@@ -49,7 +49,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

=== modified file 'account_banking_payment/view/account_payment.xml'
--- account_banking_payment/view/account_payment.xml	2013-05-01 14:46:34 +0000
+++ account_banking_payment/view/account_payment.xml	2013-05-01 14:46:34 +0000
@@ -13,12 +13,8 @@
             <field name="arch" type="xml">
                 <data>
                     <xpath expr="/form/group/button[@string='Select Invoices to Pay']"
-                           position="replace">
-                        <button colspan="2" name="%(account_payment.action_create_payment_order)s"
-                                string="Select Invoices to Pay" type="action" 
-				attrs="{'invisible':[('state','!=','draft')]}"
-                                icon="gtk-find"
-                                />
+                        position="attributes">
+                        <attribute name="attrs">{'invisible':[('state','!=','draft')]}</attribute>
                     </xpath>
                     <xpath expr="/form/group/button[@string='Make Payments']"
                            position="replace">


Follow ups