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

Proposed by Holger Brunn (Therp)
Status: Merged
Merged at revision: 162
Proposed branch: lp:~therp-nl/banking-addons/6.1_fix_multiple_invoices_no_debit_move_cliep
Merge into: lp:banking-addons/6.1
Prerequisite: lp:~therp-nl/banking-addons/6.1_fix_lacking_invoice_and_move_line
Diff against target: 70 lines (+14/-8)
2 files modified
account_banking/banking_import_transaction.py (+8/-7)
account_banking_nl_clieop/wizard/clieop.py (+6/-1)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/6.1_fix_multiple_invoices_no_debit_move_cliep
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review, no test Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+154697@code.launchpad.net

Commit message

[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
[FIX] only employ partial matching on move lines with an invoice attached
[FIX] only return matched invoice if we have a matched invoice

To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

this one also contains code changes from earlier MP, updated commit message with two extra commits

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
140 limit=0, context=context)140 limit=0, context=context)
141 orders = payment_order_obj.browse(cr, uid, order_ids, context)141 orders = payment_order_obj.browse(cr, uid, order_ids, context)
142 candidates = [x for x in orders if142 candidates = [x for x in orders if
143 is_zero(x.total - trans.transferred_amount)]143 is_zero(x.total - trans.transferred_amount) and
144 x.line_ids and x.line_ids[0].debit_move_line_id]
144 if len(candidates) > 0:145 if len(candidates) > 0:
145 # retrieve the common account_id, if any146 # retrieve the common account_id, if any
146 account_id = False147 account_id = False
@@ -374,7 +375,7 @@
374 move_line = False375 move_line = False
375 partial = False376 partial = False
376377
377 elif len(candidates) == 1:378 elif len(candidates) == 1 and candidates[0].invoice:
378 # Mismatch in amounts379 # Mismatch in amounts
379 move_line = candidates[0]380 move_line = candidates[0]
380 invoice = move_line.invoice381 invoice = move_line.invoice
@@ -422,10 +423,10 @@
422 if x.partner_id.id == move_line.partner_id.id423 if x.partner_id.id == move_line.partner_id.id
423 ]424 ]
424 425
425 return (trans, self._get_move_info(426 return (trans, self._get_move_info(
426 cr, uid, [move_line.id],427 cr, uid, [move_line.id],
427 account_ids and account_ids[0] or False),428 account_ids and account_ids[0] or False),
428 trans2)429 trans2)
429430
430 return trans, False, False431 return trans, False, False
431432
@@ -1056,7 +1057,7 @@
1056 if move_lines and len(move_lines) == 1:1057 if move_lines and len(move_lines) == 1:
1057 retval['reference'] = move_lines[0].ref1058 retval['reference'] = move_lines[0].ref
1058 if retval['match_type'] == 'invoice':1059 if retval['match_type'] == 'invoice':
1059 retval['invoice_ids'] = [x.invoice.id for x in move_lines]1060 retval['invoice_ids'] = list(set([x.invoice.id for x in move_lines]))
1060 retval['type'] = type_map[move_lines[0].invoice.type]1061 retval['type'] = type_map[move_lines[0].invoice.type]
1061 return retval1062 return retval
1062 1063
10631064
=== 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 @@
43 #def format(self, value):43 #def format(self, value):
44 # return convert.to_swift(super(SWIFTField, self).format(value))44 # return convert.to_swift(super(SWIFTField, self).format(value))
4545
46class SWIFTFieldNoLeadingWhitespace(SWIFTField):
47 def format(self, value):
48 return super(SWIFTFieldNoLeadingWhitespace, self).format(
49 self.cast(value).lstrip())
50
46def eleven_test(s):51def eleven_test(s):
47 '''52 '''
48 Dutch eleven-test for validating 9-long local bank account numbers.53 Dutch eleven-test for validating 9-long local bank account numbers.
@@ -161,7 +166,7 @@
161 _fields = [166 _fields = [
162 record.Filler('recordcode', 4, '0150'),167 record.Filler('recordcode', 4, '0150'),
163 record.Filler('variantcode', 1, 'A'),168 record.Filler('variantcode', 1, 'A'),
164 SWIFTField('paymentreference', 16),169 SWIFTFieldNoLeadingWhitespace('paymentreference', 16),
165 record.Filler('filler', 29),170 record.Filler('filler', 29),
166 ]171 ]
167172

Subscribers

People subscribed via source and target branches