From 674a50873265aff80dbb6903122facdb8dda2172 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 21 Mar 2013 14:27:19 +0100 Subject: [PATCH 1/7] [FIX] avoid linking to the same invoice twice [FIX] don't choke on order line without debit moves [FIX] seems like some fields in clieop can't start with a space --- account_banking/banking_import_transaction.py | 15 ++++++++------- account_banking_nl_clieop/wizard/clieop.py | 7 ++++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/account_banking/banking_import_transaction.py b/account_banking/banking_import_transaction.py index aad6cc8a8..da70a274c 100644 --- a/account_banking/banking_import_transaction.py +++ b/account_banking/banking_import_transaction.py @@ -140,7 +140,8 @@ class banking_import_transaction(osv.osv): 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 @@ class banking_import_transaction(osv.osv): 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 @@ class banking_import_transaction(osv.osv): 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 @@ class banking_import_transaction(osv.osv): 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 diff --git a/account_banking_nl_clieop/wizard/clieop.py b/account_banking_nl_clieop/wizard/clieop.py index 79e56f0d1..25f52982a 100644 --- a/account_banking_nl_clieop/wizard/clieop.py +++ b/account_banking_nl_clieop/wizard/clieop.py @@ -43,6 +43,11 @@ class SWIFTField(record.Field): #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 @@ class PaymentReferenceRecord(record.Record): _fields = [ record.Filler('recordcode', 4, '0150'), record.Filler('variantcode', 1, 'A'), - SWIFTField('paymentreference', 16), + SWIFTFieldNoLeadingWhitespace('paymentreference', 16), record.Filler('filler', 29), ] From 2b800751404d96f0fd6652e148a8652132908418 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 Apr 2013 16:36:15 +0200 Subject: [PATCH 2/7] [ADD] Allow manual match of multiple invoices or move lines --- account_banking/__openerp__.py | 3 + account_banking/account_banking_view.xml | 14 +- account_banking/banking_import_transaction.py | 69 ++++++- .../static/src/js/account_banking.js | 61 +++++++ .../wizard/banking_transaction_wizard.py | 168 ++++++++++++------ .../wizard/banking_transaction_wizard.xml | 21 ++- .../model/account_move_line.py | 2 +- 7 files changed, 273 insertions(+), 65 deletions(-) create mode 100644 account_banking/static/src/js/account_banking.js diff --git a/account_banking/__openerp__.py b/account_banking/__openerp__.py index 81bc377d5..a748f2764 100644 --- a/account_banking/__openerp__.py +++ b/account_banking/__openerp__.py @@ -43,6 +43,9 @@ 'wizard/banking_transaction_wizard.xml', 'workflow/account_invoice.xml', ], + 'js': [ + 'static/src/js/account_banking.js', + ], 'external_dependencies': { 'python' : ['BeautifulSoup'], }, diff --git a/account_banking/account_banking_view.xml b/account_banking/account_banking_view.xml index 104f8d1c2..a7111d62c 100644 --- a/account_banking/account_banking_view.xml +++ b/account_banking/account_banking_view.xml @@ -248,10 +248,14 @@ position="after"> -