Merge lp:~sergio-incaser/sepa-tools/sepa-tools into lp:sepa-tools

Proposed by Sergio Teruel on 2014-05-28
Status: Needs review
Proposed branch: lp:~sergio-incaser/sepa-tools/sepa-tools
Merge into: lp:sepa-tools
Diff against target: 69 lines (+30/-3)
2 files modified
account_payment_sepa_direct_debit/wizard/export_sdd.py (+29/-3)
account_payment_sepa_direct_debit/wizard/export_sdd_view.xml (+1/-0)
To merge this branch: bzr merge lp:~sergio-incaser/sepa-tools/sepa-tools
Reviewer Review Type Date Requested Status
Ignacio Ibeas (www.acysos.com) 2014-05-28 Approve on 2014-05-28
Review via email: mp+221206@code.launchpad.net

Description of the change

[IMP] Group payments from the same partner in Export SEPA Direct Debit File

To post a comment you must log in.

Unmerged revisions

8. By Sergio Teruel on 2014-05-28

[IMP] account_payment_sepa_direct_debit. Group payments from the same partner

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_payment_sepa_direct_debit/wizard/export_sdd.py'
2--- account_payment_sepa_direct_debit/wizard/export_sdd.py 2014-03-03 08:59:04 +0000
3+++ account_payment_sepa_direct_debit/wizard/export_sdd.py 2014-05-28 10:44:38 +0000
4@@ -73,6 +73,8 @@
5 'payment_order_ids': fields.many2many(
6 'payment.order', 'wiz_sdd_payorders_rel', 'wizard_id',
7 'payment_order_id', 'Payment Orders', readonly=True),
8+ 'join_payment':fields.boolean('Join Payments',
9+ help="Join payments from the same partner"),
10 }
11
12 _defaults = {
13@@ -276,7 +278,31 @@
14
15 transactions_count_2_4 = 0
16 amount_control_sum_2_5 = 0.0
17+ if sepa_export.join_payment:
18+ #To join payments from the same partner
19+ partner_dic = {}
20+ for line in lines:
21+ if sepa_export.join_payment:
22+ if line.partner_id.id in partner_dic.keys():
23+ partner_dic[line.partner_id.id]['count'] += 1
24+ partner_dic[line.partner_id.id]['amount'] += line.amount_currency
25+ partner_dic[line.partner_id.id]['ref'] += ' ' + line.ml_inv_ref.number
26+ else:
27+ partner_dic[line.partner_id.id] = {'count': 1,
28+ 'amount': line.amount_currency,
29+ 'ref': line.ml_inv_ref.number}
30 for line in lines:
31+ if sepa_export.join_payment:
32+ if partner_dic[line.partner_id.id]['count'] > 1:
33+ transactions_count_1_6 -= 1
34+ partner_dic[line.partner_id.id]['count'] -= 1
35+ continue
36+ amount_group = partner_dic[line.partner_id.id]['amount']
37+ ref_group = partner_dic[line.partner_id.id]['ref']
38+ else:
39+ amount_group = line.amount_currency
40+ ref_group = line.ml_inv_ref.number
41+
42 transactions_count_2_4 += 1
43 # C. Direct Debit Transaction Info
44 dd_transaction_info_2_28 = etree.SubElement(
45@@ -295,9 +321,9 @@
46 context=context)
47 instructed_amount_2_44 = etree.SubElement(
48 dd_transaction_info_2_28, 'InstdAmt', Ccy=currency_name)
49- instructed_amount_2_44.text = '%.2f' % line.amount_currency
50- amount_control_sum_1_7 += line.amount_currency
51- amount_control_sum_2_5 += line.amount_currency
52+ instructed_amount_2_44.text = '%.2f' % amount_group
53+ amount_control_sum_1_7 += amount_group
54+ amount_control_sum_2_5 += amount_group
55 dd_transaction_2_46 = etree.SubElement(
56 dd_transaction_info_2_28, 'DrctDbtTx')
57 mandate_related_info_2_47 = etree.SubElement(
58
59=== modified file 'account_payment_sepa_direct_debit/wizard/export_sdd_view.xml'
60--- account_payment_sepa_direct_debit/wizard/export_sdd_view.xml 2014-02-09 12:20:04 +0000
61+++ account_payment_sepa_direct_debit/wizard/export_sdd_view.xml 2014-05-28 10:44:38 +0000
62@@ -15,6 +15,7 @@
63 <field name="state" invisible="True"/>
64 <group states="create">
65 <field name="batch_booking" />
66+ <field name="join_payment" />
67 <field name="charge_bearer" />
68 </group>
69 <group states="finish">

Subscribers

People subscribed via source and target branches