banking-addons-team team mailing list archive
-
banking-addons-team team
-
Mailing list archive
-
Message #01995
[Merge] lp:~sergio-incaser/banking-addons/banking-addons into lp:banking-addons
Sergio Teruel has proposed merging lp:~sergio-incaser/banking-addons/banking-addons into lp:banking-addons.
Requested reviews:
Banking Addons Core Editors (banking-addons-team)
For more details, see:
https://code.launchpad.net/~sergio-incaser/banking-addons/banking-addons/+merge/221197
[IMP] Group payments from the same partner
--
https://code.launchpad.net/~sergio-incaser/banking-addons/banking-addons/+merge/221197
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~sergio-incaser/banking-addons/banking-addons into lp:banking-addons.
=== modified file 'account_banking_sepa_direct_debit/wizard/export_sdd.py'
--- account_banking_sepa_direct_debit/wizard/export_sdd.py 2014-01-05 23:51:22 +0000
+++ account_banking_sepa_direct_debit/wizard/export_sdd.py 2014-05-28 10:01:31 +0000
@@ -73,6 +73,8 @@
'payment_order_ids': fields.many2many(
'payment.order', 'wiz_sdd_payorders_rel', 'wizard_id',
'payment_order_id', 'Payment Orders', readonly=True),
+ 'join_payment':fields.boolean('Join Payments',
+ help="Join payments from the same partner"),
}
_defaults = {
@@ -276,7 +278,31 @@
transactions_count_2_4 = 0
amount_control_sum_2_5 = 0.0
+ if sepa_export.join_payment:
+ #To join payments from the same partner
+ partner_dic = {}
+ for line in lines:
+ if sepa_export.join_payment:
+ if line.partner_id.id in partner_dic.keys():
+ partner_dic[line.partner_id.id]['count'] += 1
+ partner_dic[line.partner_id.id]['amount'] += line.amount_currency
+ partner_dic[line.partner_id.id]['ref'] += ' ' + line.ml_inv_ref.number
+ else:
+ partner_dic[line.partner_id.id] = {'count': 1,
+ 'amount': line.amount_currency,
+ 'ref': line.ml_inv_ref.number}
for line in lines:
+ if sepa_export.join_payment:
+ if partner_dic[line.partner_id.id]['count'] > 1:
+ transactions_count_1_6 -= 1
+ partner_dic[line.partner_id.id]['count'] -= 1
+ continue
+ amount_group = partner_dic[line.partner_id.id]['amount']
+ ref_group = partner_dic[line.partner_id.id]['ref']
+ else:
+ amount_group = line.amount_currency
+ ref_group = line.ml_inv_ref.number
+
transactions_count_2_4 += 1
# C. Direct Debit Transaction Info
dd_transaction_info_2_28 = etree.SubElement(
@@ -295,9 +321,9 @@
context=context)
instructed_amount_2_44 = etree.SubElement(
dd_transaction_info_2_28, 'InstdAmt', Ccy=currency_name)
- instructed_amount_2_44.text = '%.2f' % line.amount_currency
- amount_control_sum_1_7 += line.amount_currency
- amount_control_sum_2_5 += line.amount_currency
+ instructed_amount_2_44.text = '%.2f' % amount_group
+ amount_control_sum_1_7 += amount_group
+ amount_control_sum_2_5 += amount_group
dd_transaction_2_46 = etree.SubElement(
dd_transaction_info_2_28, 'DrctDbtTx')
mandate_related_info_2_47 = etree.SubElement(
=== modified file 'account_banking_sepa_direct_debit/wizard/export_sdd_view.xml'
--- account_banking_sepa_direct_debit/wizard/export_sdd_view.xml 2013-12-12 22:19:53 +0000
+++ account_banking_sepa_direct_debit/wizard/export_sdd_view.xml 2014-05-28 10:01:31 +0000
@@ -15,6 +15,7 @@
<field name="state" invisible="True"/>
<group states="create">
<field name="batch_booking" />
+ <field name="join_payment" />
<field name="charge_bearer" />
</group>
<group states="finish">
Follow ups