diff --git a/l10n_ch_pain_base/README.rst b/l10n_ch_pain_base/README.rst new file mode 100644 index 000000000..1775ec026 --- /dev/null +++ b/l10n_ch_pain_base/README.rst @@ -0,0 +1,79 @@ +======================= +Switzerland - ISO 20022 +======================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--switzerland-lightgray.png?logo=github + :target: https://github.com/OCA/l10n-switzerland/tree/12.0/l10n_ch_pain_base + :alt: OCA/l10n-switzerland +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/l10n-switzerland-12-0/l10n-switzerland-12-0-l10n_ch_pain_base + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/125/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module doesn't do anything by himself. It is the base module for 2 other modules: + +* the module *l10n_ch_pain_credit_transfer* which adds support for the file format *pain.001.001.03.ch.02* which is used for ISO 20022 credit transfers (SEPA or not SEPA), +* the module *l10n_ch_pain_direct_debit* which adds support for the file format *pain.008.001.02.ch.01* which is used for ISO 20022 direct debits. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Alexis de Lattre +* Denis Leemann +* Mykhailo Panarin + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/l10n-switzerland `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_ch_pain_base/__init__.py b/l10n_ch_pain_base/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/l10n_ch_pain_base/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/l10n_ch_pain_base/__manifest__.py b/l10n_ch_pain_base/__manifest__.py new file mode 100644 index 000000000..7614c05ea --- /dev/null +++ b/l10n_ch_pain_base/__manifest__.py @@ -0,0 +1,16 @@ +# copyright 2016 Akretion (Alexis de Lattre ) +# copyright 2011 Camptocamp SA (Yannick Vaucher) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Switzerland - ISO 20022", + "summary": "ISO 20022 base module for Switzerland", + "version": "14.0.1.0.0", + "category": "Finance", + "website": "https://github.com/OCA/l10n-switzerland", + "author": "Akretion,Camptocamp,Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["account_banking_pain_base", "l10n_ch_base_bank"], + "data": ["views/account_payment_line.xml"], + "installable": True, +} diff --git a/l10n_ch_pain_base/i18n/de.po b/l10n_ch_pain_base/i18n/de.po new file mode 100644 index 000000000..56c16a821 --- /dev/null +++ b/l10n_ch_pain_base/i18n/de.po @@ -0,0 +1,91 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ch_pain_base +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-04-19 00:40+0000\n" +"PO-Revision-Date: 2018-11-23 22:11+0000\n" +"Last-Translator: chrispi-ch \n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.2.2\n" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,local_instrument:0 +msgid "CH01 (ISR)" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model.fields,field_description:l10n_ch_pain_base.field_account_payment_line__communication_type +msgid "Communication Type" +msgstr "" + +#. module: l10n_ch_pain_base +#: code:addons/l10n_ch_pain_base/models/account_payment_order.py:72 +#, python-format +msgid "" +"For pain.001.001.03.ch.02, for non-ISR payments, the BIC is required on the " +"bank '%s' related to the bank account '%s'" +msgstr "" +"Bei pain.001.001.03.ch.02 ist für Nicht-ESR-Zahlungen der BIC zur Bank '%s' " +"des Bankkontos '%s' erforderlich" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "Free" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "ISO" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "ISR" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,local_instrument:0 +msgid "Instant Transfer" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_move_line +msgid "Journal Item" +msgstr "Journaleintrag" + +#. module: l10n_ch_pain_base +#: model:ir.model.fields,field_description:l10n_ch_pain_base.field_account_payment_line__local_instrument +msgid "Local Instrument" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_payment_line +msgid "Payment Lines" +msgstr "Zahlungszeilen" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_payment_order +msgid "Payment Order" +msgstr "Zahlungsauftrag" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "QRR" +msgstr "" + +#. module: l10n_ch_pain_base +#: code:addons/l10n_ch_pain_base/models/account_payment_order.py:90 +#, fuzzy, python-format +msgid "The field 'Postal account' is not set on the bank account '%s'." +msgstr "Das Feld 'Postkonto' ist beim Bankkonto '%s' nicht gesetzt." diff --git a/l10n_ch_pain_base/i18n/fr.po b/l10n_ch_pain_base/i18n/fr.po new file mode 100644 index 000000000..e8bea309f --- /dev/null +++ b/l10n_ch_pain_base/i18n/fr.po @@ -0,0 +1,92 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ch_pain_base +# +# Translators: +# leemannd , 2017 +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-01 03:54+0000\n" +"PO-Revision-Date: 2019-08-14 09:44+0000\n" +"Last-Translator: Valaeys Stéphane \n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.7.1\n" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,local_instrument:0 +msgid "CH01 (ISR)" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model.fields,field_description:l10n_ch_pain_base.field_account_payment_line__communication_type +msgid "Communication Type" +msgstr "" + +#. module: l10n_ch_pain_base +#: code:addons/l10n_ch_pain_base/models/account_payment_order.py:72 +#, python-format +msgid "" +"For pain.001.001.03.ch.02, for non-ISR payments, the BIC is required on the " +"bank '%s' related to the bank account '%s'" +msgstr "" +"Pour pain.001.001.03.ch.02 et les paiements non-BVR, le BIC est requis sur " +"les Banques '%s' lié au compte bancaire '%s'" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "Free" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "ISO" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "ISR" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,local_instrument:0 +msgid "Instant Transfer" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_move_line +msgid "Journal Item" +msgstr "Écriture comptable" + +#. module: l10n_ch_pain_base +#: model:ir.model.fields,field_description:l10n_ch_pain_base.field_account_payment_line__local_instrument +msgid "Local Instrument" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_payment_line +msgid "Payment Lines" +msgstr "Lignes de Paiement" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_payment_order +msgid "Payment Order" +msgstr "Ordre de paiement" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "QRR" +msgstr "" + +#. module: l10n_ch_pain_base +#: code:addons/l10n_ch_pain_base/models/account_payment_order.py:90 +#, fuzzy, python-format +msgid "The field 'Postal account' is not set on the bank account '%s'." +msgstr "Le champ 'CCP' n'est pas défini sur le compte bancaire '%s'." diff --git a/l10n_ch_pain_base/i18n/it.po b/l10n_ch_pain_base/i18n/it.po new file mode 100644 index 000000000..39823d224 --- /dev/null +++ b/l10n_ch_pain_base/i18n/it.po @@ -0,0 +1,88 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ch_pain_base +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-03 03:39+0000\n" +"PO-Revision-Date: 2017-03-03 03:39+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,local_instrument:0 +msgid "CH01 (ISR)" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model.fields,field_description:l10n_ch_pain_base.field_account_payment_line__communication_type +msgid "Communication Type" +msgstr "" + +#. module: l10n_ch_pain_base +#: code:addons/l10n_ch_pain_base/models/account_payment_order.py:72 +#, python-format +msgid "" +"For pain.001.001.03.ch.02, for non-ISR payments, the BIC is required on the " +"bank '%s' related to the bank account '%s'" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "Free" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "ISO" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "ISR" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,local_instrument:0 +msgid "Instant Transfer" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model.fields,field_description:l10n_ch_pain_base.field_account_payment_line__local_instrument +msgid "Local Instrument" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_payment_line +msgid "Payment Lines" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_payment_order +msgid "Payment Order" +msgstr "Ordine di Pagamento" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "QRR" +msgstr "" + +#. module: l10n_ch_pain_base +#: code:addons/l10n_ch_pain_base/models/account_payment_order.py:90 +#, python-format +msgid "The field 'Postal account' is not set on the bank account '%s'." +msgstr "" diff --git a/l10n_ch_pain_base/i18n/l10n_ch_pain_base.pot b/l10n_ch_pain_base/i18n/l10n_ch_pain_base.pot new file mode 100644 index 000000000..81f31b421 --- /dev/null +++ b/l10n_ch_pain_base/i18n/l10n_ch_pain_base.pot @@ -0,0 +1,82 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ch_pain_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,local_instrument:0 +msgid "CH01 (ISR)" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model.fields,field_description:l10n_ch_pain_base.field_account_payment_line__communication_type +msgid "Communication Type" +msgstr "" + +#. module: l10n_ch_pain_base +#: code:addons/l10n_ch_pain_base/models/account_payment_order.py:72 +#, python-format +msgid "For pain.001.001.03.ch.02, for non-ISR payments, the BIC is required on the bank '%s' related to the bank account '%s'" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "Free" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "ISO" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "ISR" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,local_instrument:0 +msgid "Instant Transfer" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model.fields,field_description:l10n_ch_pain_base.field_account_payment_line__local_instrument +msgid "Local Instrument" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_payment_line +msgid "Payment Lines" +msgstr "" + +#. module: l10n_ch_pain_base +#: model:ir.model,name:l10n_ch_pain_base.model_account_payment_order +msgid "Payment Order" +msgstr "" + +#. module: l10n_ch_pain_base +#: selection:account.payment.line,communication_type:0 +msgid "QRR" +msgstr "" + +#. module: l10n_ch_pain_base +#: code:addons/l10n_ch_pain_base/models/account_payment_order.py:90 +#, python-format +msgid "The field 'Postal account' is not set on the bank account '%s'." +msgstr "" + diff --git a/l10n_ch_pain_base/models/__init__.py b/l10n_ch_pain_base/models/__init__.py new file mode 100644 index 000000000..065d5b2d3 --- /dev/null +++ b/l10n_ch_pain_base/models/__init__.py @@ -0,0 +1,3 @@ +from . import account_payment_order +from . import account_payment_line +from . import account_move_line diff --git a/l10n_ch_pain_base/models/account_move_line.py b/l10n_ch_pain_base/models/account_move_line.py new file mode 100644 index 000000000..a9bda5d40 --- /dev/null +++ b/l10n_ch_pain_base/models/account_move_line.py @@ -0,0 +1,24 @@ +# copyright 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + def _prepare_payment_line_vals(self, payment_order): + vals = super()._prepare_payment_line_vals(payment_order) + if ( + self.move_id + and self.move_id._has_isr_ref() + and self.move_id.partner_bank_id + ): + if self.move_id.partner_bank_id._is_qr_iban(): + vals["communication_type"] = "qrr" + else: + vals["local_instrument"] = "CH01" + vals["communication_type"] = "isr" + if vals["communication"]: + vals["communication"] = vals["communication"].replace(" ", "") + return vals diff --git a/l10n_ch_pain_base/models/account_payment_line.py b/l10n_ch_pain_base/models/account_payment_line.py new file mode 100644 index 000000000..a1d65ca41 --- /dev/null +++ b/l10n_ch_pain_base/models/account_payment_line.py @@ -0,0 +1,21 @@ +# copyright 2016 Akretion - Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class AccountPaymentLine(models.Model): + _inherit = "account.payment.line" + + local_instrument = fields.Selection( + selection_add=[("CH01", "CH01 (ISR)")], ondelete={"CH01": "set null"} + ) + communication_type = fields.Selection( + selection_add=[("isr", "ISR"), ("qrr", "QRR")], + ondelete={"isr": "set default", "qrr": "set default"}, + ) + + def invoice_reference_type2communication_type(self): + res = super().invoice_reference_type2communication_type() + res["isr"] = "isr" + return res diff --git a/l10n_ch_pain_base/models/account_payment_order.py b/l10n_ch_pain_base/models/account_payment_order.py new file mode 100644 index 000000000..7b86930b4 --- /dev/null +++ b/l10n_ch_pain_base/models/account_payment_order.py @@ -0,0 +1,179 @@ +# copyright 2016 Akretion (www.akretion.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from lxml import etree + +from odoo import _, api, models +from odoo.exceptions import UserError + + +class AccountPaymentOrder(models.Model): + _inherit = "account.payment.order" + + def compute_sepa_final_hook(self, sepa): + self.ensure_one() + sepa = super().compute_sepa_final_hook(sepa) + pain_flavor = self.payment_mode_id.payment_method_id.pain_version + # ISR orders cannot be SEPA orders + if pain_flavor and ".ch." in pain_flavor: + sepa = False + return sepa + + def generate_pain_nsmap(self): + self.ensure_one() + nsmap = super().generate_pain_nsmap() + pain_flavor = self.payment_mode_id.payment_method_id.pain_version + if pain_flavor in ["pain.001.001.03.ch.02", "pain.008.001.02.ch.01"]: + nsmap[None] = ( + "http://www.six-interbank-clearing.com/de/" "%s.xsd" % pain_flavor + ) + + return nsmap + + def generate_pain_attrib(self): + self.ensure_one() + pain_flavor = self.payment_mode_id.payment_method_id.pain_version + if pain_flavor in ["pain.001.001.03.ch.02", "pain.008.001.02.ch.01"]: + attrib = { + "{http://www.w3.org/2001/XMLSchema-instance}" + "schemaLocation": "http://www.six-interbank-clearing.com/de/" + "%s.xsd %s.xsd" % (pain_flavor, pain_flavor) + } + return attrib + else: + return super().generate_pain_attrib() + + @api.model + def generate_start_payment_info_block( + self, + parent_node, + payment_info_ident, + priority, + local_instrument, + category_purpose, + sequence_type, + requested_date, + eval_ctx, + gen_args, + ): + if gen_args.get("pain_flavor") == "pain.001.001.03.ch.02": + gen_args["local_instrument_type"] = "proprietary" + gen_args["structured_remittance_issuer"] = False + return super().generate_start_payment_info_block( + parent_node, + payment_info_ident, + priority, + local_instrument, + category_purpose, + sequence_type, + requested_date, + eval_ctx, + gen_args, + ) + + @api.model + def generate_party_agent( + self, parent_node, party_type, order, partner_bank, gen_args, bank_line=None + ): + if gen_args.get("pain_flavor") == "pain.001.001.03.ch.02" and bank_line: + if bank_line.payment_line_ids[:1].local_instrument == "CH01": + # Don't set the creditor agent on ISR/CH01 payments + return True + elif not partner_bank.bank_bic: + raise UserError( + _( + "For pain.001.001.03.ch.02, for non-ISR payments, " + "the BIC is required on the bank '%s' related to the " + "bank account '%s'" + ) + % (partner_bank.bank_id.name, partner_bank.acc_number) + ) + return super().generate_party_agent( + parent_node, + party_type, + order, + partner_bank, + gen_args, + bank_line=bank_line, + ) + + @api.model + def generate_party_acc_number( + self, parent_node, party_type, order, partner_bank, gen_args, bank_line=None + ): + if ( + gen_args.get("pain_flavor") == "pain.001.001.03.ch.02" + and bank_line + and bank_line.payment_line_ids[:1].local_instrument == "CH01" + ): + if not partner_bank.l10n_ch_postal: + raise UserError( + _( + "The field 'Postal account' is not set on the bank " + "account '%s'." + ) + % partner_bank.acc_number + ) + party_account = etree.SubElement(parent_node, "%sAcct" % party_type) + party_account_id = etree.SubElement(party_account, "Id") + party_account_other = etree.SubElement(party_account_id, "Othr") + party_account_other_id = etree.SubElement(party_account_other, "Id") + party_account_other_id.text = partner_bank.l10n_ch_postal + return True + else: + return super().generate_party_acc_number( + parent_node, + party_type, + order, + partner_bank, + gen_args, + bank_line=bank_line, + ) + + @api.model + def generate_address_block(self, parent_node, partner, gen_args): + """Generate the piece of the XML corresponding to PstlAdr""" + if partner.country_id: + postal_address = etree.SubElement(parent_node, "PstlAdr") + + country = etree.SubElement(postal_address, "Ctry") + country.text = self._prepare_field( + "Country", + "partner.country_id.code", + {"partner": partner}, + 2, + gen_args=gen_args, + ) + + if partner.street or partner.street2: + adrline1 = etree.SubElement(postal_address, "AdrLine") + adrline1.text = ", ".join( + filter(None, [partner.street, partner.street2]) + ) + + if partner.zip and partner.city: + adrline2 = etree.SubElement(postal_address, "AdrLine") + adrline2.text = " ".join([partner.zip, partner.city]) + + return True + + @api.model + def generate_remittance_info_block(self, parent_node, line, gen_args): + if line.payment_line_ids[:1].communication_type == "qrr": + remittance_info = etree.SubElement(parent_node, "RmtInf") + remittance_info_structured = etree.SubElement(remittance_info, "Strd") + creditor_ref_information = etree.SubElement( + remittance_info_structured, "CdtrRefInf" + ) + creditor_ref_info_type = etree.SubElement(creditor_ref_information, "Tp") + creditor_ref_info_type_or = etree.SubElement( + creditor_ref_info_type, "CdOrPrtry" + ) + creditor_ref_info_type_code = etree.SubElement( + creditor_ref_info_type_or, "Prtry" + ) + creditor_ref_info_type_code.text = "QRR" + creditor_reference = etree.SubElement(creditor_ref_information, "Ref") + creditor_reference.text = line.payment_line_ids[0].communication + else: + super().generate_remittance_info_block(parent_node, line, gen_args) diff --git a/l10n_ch_pain_base/readme/CONTRIBUTORS.rst b/l10n_ch_pain_base/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..4f35f64a5 --- /dev/null +++ b/l10n_ch_pain_base/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Alexis de Lattre +* Denis Leemann +* Mykhailo Panarin diff --git a/l10n_ch_pain_base/readme/DESCRIPTION.rst b/l10n_ch_pain_base/readme/DESCRIPTION.rst new file mode 100644 index 000000000..be01b0c7c --- /dev/null +++ b/l10n_ch_pain_base/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module doesn't do anything by himself. It is the base module for 2 other modules: + +* the module *l10n_ch_pain_credit_transfer* which adds support for the file format *pain.001.001.03.ch.02* which is used for ISO 20022 credit transfers (SEPA or not SEPA), +* the module *l10n_ch_pain_direct_debit* which adds support for the file format *pain.008.001.02.ch.01* which is used for ISO 20022 direct debits. diff --git a/l10n_ch_pain_base/static/description/icon.png b/l10n_ch_pain_base/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/l10n_ch_pain_base/static/description/icon.png differ diff --git a/l10n_ch_pain_base/static/description/index.html b/l10n_ch_pain_base/static/description/index.html new file mode 100644 index 000000000..8747dbb49 --- /dev/null +++ b/l10n_ch_pain_base/static/description/index.html @@ -0,0 +1,426 @@ + + + + + + +Switzerland - ISO 20022 + + + +
+

Switzerland - ISO 20022

+ + +

Beta License: AGPL-3 OCA/l10n-switzerland Translate me on Weblate Try me on Runbot

+

This module doesn’t do anything by himself. It is the base module for 2 other modules:

+
    +
  • the module l10n_ch_pain_credit_transfer which adds support for the file format pain.001.001.03.ch.02 which is used for ISO 20022 credit transfers (SEPA or not SEPA),
  • +
  • the module l10n_ch_pain_direct_debit which adds support for the file format pain.008.001.02.ch.01 which is used for ISO 20022 direct debits.
  • +
+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/l10n-switzerland project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/l10n_ch_pain_base/views/account_payment_line.xml b/l10n_ch_pain_base/views/account_payment_line.xml new file mode 100644 index 000000000..58c406ec6 --- /dev/null +++ b/l10n_ch_pain_base/views/account_payment_line.xml @@ -0,0 +1,22 @@ + + + + + + l10n_ch_sepa.account.payment.line + account.payment.line + + + + 0 + + + + + diff --git a/setup/l10n_ch_pain_base/odoo/addons/l10n_ch_pain_base b/setup/l10n_ch_pain_base/odoo/addons/l10n_ch_pain_base new file mode 120000 index 000000000..836809e69 --- /dev/null +++ b/setup/l10n_ch_pain_base/odoo/addons/l10n_ch_pain_base @@ -0,0 +1 @@ +../../../../l10n_ch_pain_base \ No newline at end of file diff --git a/setup/l10n_ch_pain_base/setup.py b/setup/l10n_ch_pain_base/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/l10n_ch_pain_base/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)