changeset 0dce2d991c70 in modules/account_payment_sepa:default
details: 
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset&node=0dce2d991c70
description:
        Add wizard to create direct debit for configured parties

        issue10772
        review379071002
diffstat:

 __init__.py                                |   1 +
 party.py                                   |  20 ++++++++++++++++++++
 party.xml                                  |   6 ++++++
 view/party_reception_direct_debit_form.xml |  10 ++++++++++
 4 files changed, 37 insertions(+), 0 deletions(-)

diffs (70 lines):

diff -r e2e7f112f269 -r 0dce2d991c70 __init__.py
--- a/__init__.py       Sun Oct 10 22:15:08 2021 +0200
+++ b/__init__.py       Mon Oct 11 18:35:27 2021 +0200
@@ -14,6 +14,7 @@
         payment.Payment,
         payment.Message,
         party.Party,
+        party.PartyReceptionDirectDebit,
         party.PartyIdentifier,
         account.Configuration,
         account.ConfigurationSepaMandateSequence,
diff -r e2e7f112f269 -r 0dce2d991c70 party.py
--- a/party.py  Sun Oct 10 22:15:08 2021 +0200
+++ b/party.py  Mon Oct 11 18:35:27 2021 +0200
@@ -72,6 +72,26 @@
                     type=type))
 
 
+class PartyReceptionDirectDebit(metaclass=PoolMeta):
+    __name__ = 'party.party.reception_direct_debit'
+
+    sepa_mandate = fields.Many2One(
+        'account.payment.sepa.mandate', "Mandate", ondelete='CASCADE',
+        domain=[
+            ('party', '=', Eval('party', -1)),
+            ],
+        states={
+            'invisible': Eval('process_method') != 'sepa',
+            'readonly': ~Eval('party') | (Eval('party', -1) < 0),
+            },
+        depends=['party', 'process_method'])
+
+    def _get_payment(self, line, date, amount):
+        payment = super()._get_payment(line, date, amount)
+        payment.sepa_mandate = self.sepa_mandate
+        return payment
+
+
 class PartyIdentifier(metaclass=PoolMeta):
     __name__ = 'party.identifier'
 
diff -r e2e7f112f269 -r 0dce2d991c70 party.xml
--- a/party.xml Sun Oct 10 22:15:08 2021 +0200
+++ b/party.xml Mon Oct 11 18:35:27 2021 +0200
@@ -32,5 +32,11 @@
             <field name="model">party.party,-1</field>
             <field name="action" ref="act_mandate_form2"/>
         </record>
+
+        <record model="ir.ui.view" id="party_reception_direct_debit_view_form">
+            <field name="model">party.party.reception_direct_debit</field>
+            <field name="inherit" 
ref="account_payment.party_reception_direct_debit_view_form"/>
+            <field name="name">party_reception_direct_debit_form</field>
+        </record>
     </data>
 </tryton>
diff -r e2e7f112f269 -r 0dce2d991c70 view/party_reception_direct_debit_form.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/party_reception_direct_debit_form.xml        Mon Oct 11 18:35:27 
2021 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<data>
+    <xpath expr="//field[@name='currency']" position="after">
+        <label name="sepa_mandate"/>
+        <field name="sepa_mandate"/>
+        <newline/>
+    </xpath>
+</data>

Reply via email to