From d20220ef0e2c9d2cbfd5c1c12e9a5ff54f6526ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 11 Oct 2021 18:35:27 +0200 Subject: [PATCH] Add wizard to create direct debit for configured parties issue10772 review379071002 --- __init__.py | 1 + party.py | 20 ++++++++++++++++++++ party.xml | 6 ++++++ view/party_reception_direct_debit_form.xml | 10 ++++++++++ 4 files changed, 37 insertions(+) create mode 100644 view/party_reception_direct_debit_form.xml diff --git a/__init__.py b/__init__.py index f3223e03cc..e223ebe04e 100644 --- a/__init__.py +++ b/__init__.py @@ -14,6 +14,7 @@ def register(): payment.Payment, payment.Message, party.Party, + party.PartyReceptionDirectDebit, party.PartyIdentifier, account.Configuration, account.ConfigurationSepaMandateSequence, diff --git a/party.py b/party.py index 6c24ed437b..39d9f716c2 100644 --- a/party.py +++ b/party.py @@ -72,6 +72,26 @@ class Party(metaclass=PoolMeta): 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 --git a/party.xml b/party.xml index 7a814a2739..c70d31eded 100644 --- a/party.xml +++ b/party.xml @@ -32,5 +32,11 @@ this repository contains the full copyright notices and license terms. --> party.party,-1 + + + party.party.reception_direct_debit + + party_reception_direct_debit_form + diff --git a/view/party_reception_direct_debit_form.xml b/view/party_reception_direct_debit_form.xml new file mode 100644 index 0000000000..784e6ed023 --- /dev/null +++ b/view/party_reception_direct_debit_form.xml @@ -0,0 +1,10 @@ + + + + + +