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
1=== modified file 'account_banking/banking_import_transaction.py'
2--- account_banking/banking_import_transaction.py 2013-02-07 09:56:06 +0000
3+++ account_banking/banking_import_transaction.py 2013-03-21 13:31:59 +0000
4@@ -140,7 +140,8 @@
5 limit=0, context=context)
6 orders = payment_order_obj.browse(cr, uid, order_ids, context)
7 candidates = [x for x in orders if
8- is_zero(x.total - trans.transferred_amount)]
9+ is_zero(x.total - trans.transferred_amount) and
10+ x.line_ids and x.line_ids[0].debit_move_line_id]
11 if len(candidates) > 0:
12 # retrieve the common account_id, if any
13 account_id = False
14@@ -374,7 +375,7 @@
15 move_line = False
16 partial = False
17
18- elif len(candidates) == 1:
19+ elif len(candidates) == 1 and candidates[0].invoice:
20 # Mismatch in amounts
21 move_line = candidates[0]
22 invoice = move_line.invoice
23@@ -422,10 +423,10 @@
24 if x.partner_id.id == move_line.partner_id.id
25 ]
26
27- return (trans, self._get_move_info(
28- cr, uid, [move_line.id],
29- account_ids and account_ids[0] or False),
30- trans2)
31+ return (trans, self._get_move_info(
32+ cr, uid, [move_line.id],
33+ account_ids and account_ids[0] or False),
34+ trans2)
35
36 return trans, False, False
37
38@@ -1056,7 +1057,7 @@
39 if move_lines and len(move_lines) == 1:
40 retval['reference'] = move_lines[0].ref
41 if retval['match_type'] == 'invoice':
42- retval['invoice_ids'] = [x.invoice.id for x in move_lines]
43+ retval['invoice_ids'] = list(set([x.invoice.id for x in move_lines]))
44 retval['type'] = type_map[move_lines[0].invoice.type]
45 return retval
46
47
48=== modified file 'account_banking_nl_clieop/wizard/clieop.py'
49--- account_banking_nl_clieop/wizard/clieop.py 2013-01-28 10:19:32 +0000
50+++ account_banking_nl_clieop/wizard/clieop.py 2013-03-21 13:31:59 +0000
51@@ -43,6 +43,11 @@
52 #def format(self, value):
53 # return convert.to_swift(super(SWIFTField, self).format(value))
54
55+class SWIFTFieldNoLeadingWhitespace(SWIFTField):
56+ def format(self, value):
57+ return super(SWIFTFieldNoLeadingWhitespace, self).format(
58+ self.cast(value).lstrip())
59+
60 def eleven_test(s):
61 '''
62 Dutch eleven-test for validating 9-long local bank account numbers.
63@@ -161,7 +166,7 @@
64 _fields = [
65 record.Filler('recordcode', 4, '0150'),
66 record.Filler('variantcode', 1, 'A'),
67- SWIFTField('paymentreference', 16),
68+ SWIFTFieldNoLeadingWhitespace('paymentreference', 16),
69 record.Filler('filler', 29),
70 ]
71

Subscribers

People subscribed via source and target branches