diff --git a/account_banking_pain_base/models/account_payment_order.py b/account_banking_pain_base/models/account_payment_order.py index 3d563021e..5c6a0580f 100644 --- a/account_banking_pain_base/models/account_payment_order.py +++ b/account_banking_pain_base/models/account_payment_order.py @@ -97,7 +97,7 @@ class AccountPaymentOrder(models.Model): '[', ']', '^', '_', '`', '{', '}', '|', '~', '\\', '!'] for unallowed_ascii_char in unallowed_ascii_chars: value = value.replace(unallowed_ascii_char, '-') - except: + except Exception: line = eval_ctx.get('line') if line: raise UserError( diff --git a/account_banking_pain_base/models/res_config_settings.py b/account_banking_pain_base/models/res_config_settings.py index 60d804969..f4e94ef79 100644 --- a/account_banking_pain_base/models/res_config_settings.py +++ b/account_banking_pain_base/models/res_config_settings.py @@ -9,11 +9,17 @@ class ResConfigSettings(models.TransientModel): _inherit = 'res.config.settings' initiating_party_issuer = fields.Char( - related='company_id.initiating_party_issuer') + related='company_id.initiating_party_issuer', + readonly=False, + ) initiating_party_identifier = fields.Char( - related='company_id.initiating_party_identifier') + related='company_id.initiating_party_identifier', + readonly=False, + ) initiating_party_scheme = fields.Char( - related='company_id.initiating_party_scheme') + related='company_id.initiating_party_scheme', + readonly=False, + ) group_pain_multiple_identifier = fields.Boolean( string='Multiple identifiers', implied_group='account_banking_pain_base.' diff --git a/account_banking_sepa_credit_transfer/README.rst b/account_banking_sepa_credit_transfer/README.rst new file mode 100644 index 000000000..37e946297 --- /dev/null +++ b/account_banking_sepa_credit_transfer/README.rst @@ -0,0 +1,125 @@ +==================================== +Account Banking SEPA Credit Transfer +==================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fbank--payment-lightgray.png?logo=github + :target: https://github.com/OCA/bank-payment/tree/12.0/account_banking_sepa_credit_transfer + :alt: OCA/bank-payment +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/bank-payment-12-0/bank-payment-12-0-account_banking_sepa_credit_transfer + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/97/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Module to export payment orders in SEPA XML file format. + +SEPA PAIN (PAyment INitiation) is the new european standard for +Customer-to-Bank payment instructions. This module implements SEPA Credit +Transfer (SCT), more specifically PAIN versions 001.001.02, 001.001.03, +001.001.04 and 001.001.05. It is part of the ISO 20022 standard, available on +https://www.iso20022.org. + +The Implementation Guidelines for SEPA Credit Transfer published by the +European Payments Council (https://www.europeanpaymentscouncil.eu) use +PAIN version 001.001.03, so it's probably the version of PAIN that you should +try first. + +It also includes pain.001.003.03 which is used in Germany instead of 001.001.03. +You can read more about this here (only in german language): +http://www.ebics.de/startseite/ + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +This module depends on : +* account_banking_pain_base + +This module is part of the OCA/bank-payment suite. + +Configuration +============= + +* Create a Payment Mode dedicated to SEPA Credit Transfer. + +* Select the Payment Method *SEPA Credit Transfer to suppliers* (which is + automatically created upon module installation). + +* Check that this payment method uses the proper version of PAIN. + +Usage +===== + +In the menu *Invoicing/Accounting > Payments > Payment Order*, create a new +payment order and select the Payment Mode dedicated to SEPA Credit +Transfer that you created during the configuration step. + +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 +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Alexis de Lattre +* Stéphane Bidoul +* Stefan Rijnhart +* Julien Laloux +* Alexandre Fayolle +* Raphaël Valyi +* Erwin van der Ploeg +* Sandy Carter +* `Tecnativa `__: + + * Antonio Espinosa + * Pedro M. Baeza + +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/bank-payment `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_banking_sepa_credit_transfer/__init__.py b/account_banking_sepa_credit_transfer/__init__.py new file mode 100644 index 000000000..24b65ee99 --- /dev/null +++ b/account_banking_sepa_credit_transfer/__init__.py @@ -0,0 +1,3 @@ + +from . import models +from .post_install import update_bank_journals diff --git a/account_banking_sepa_credit_transfer/__manifest__.py b/account_banking_sepa_credit_transfer/__manifest__.py new file mode 100644 index 000000000..620e4e23d --- /dev/null +++ b/account_banking_sepa_credit_transfer/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright 2010-2016 Akretion (www.akretion.com) +# Copyright 2016 Tecnativa - Antonio Espinosa +# Copyright 2014-2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Account Banking SEPA Credit Transfer', + 'summary': 'Create SEPA XML files for Credit Transfers', + 'version': '12.0.1.0.0', + 'license': 'AGPL-3', + 'author': "Akretion, " + "Tecnativa, " + "Odoo Community Association (OCA)", + 'website': 'https://github.com/OCA/bank-payment', + 'category': 'Banking addons', + 'conflicts': ['account_sepa'], + 'depends': ['account_banking_pain_base'], + 'data': [ + 'data/account_payment_method.xml', + ], + 'demo': [ + 'demo/sepa_credit_transfer_demo.xml' + ], + 'post_init_hook': 'update_bank_journals', + 'installable': True, +} diff --git a/account_banking_sepa_credit_transfer/data/account_payment_method.xml b/account_banking_sepa_credit_transfer/data/account_payment_method.xml new file mode 100644 index 000000000..515314b5a --- /dev/null +++ b/account_banking_sepa_credit_transfer/data/account_payment_method.xml @@ -0,0 +1,14 @@ + + + + + + SEPA Credit Transfer to suppliers + sepa_credit_transfer + outbound + + pain.001.001.03 + + + + diff --git a/account_banking_sepa_credit_transfer/data/pain.001.001.02.xsd b/account_banking_sepa_credit_transfer/data/pain.001.001.02.xsd new file mode 100644 index 000000000..43529da1b --- /dev/null +++ b/account_banking_sepa_credit_transfer/data/pain.001.001.02.xsd @@ -0,0 +1,784 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/account_banking_sepa_credit_transfer/data/pain.001.001.03.xsd b/account_banking_sepa_credit_transfer/data/pain.001.001.03.xsd new file mode 100644 index 000000000..864977991 --- /dev/null +++ b/account_banking_sepa_credit_transfer/data/pain.001.001.03.xsd @@ -0,0 +1,921 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/account_banking_sepa_credit_transfer/data/pain.001.001.04.xsd b/account_banking_sepa_credit_transfer/data/pain.001.001.04.xsd new file mode 100644 index 000000000..813c7fe29 --- /dev/null +++ b/account_banking_sepa_credit_transfer/data/pain.001.001.04.xsd @@ -0,0 +1,968 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/account_banking_sepa_credit_transfer/data/pain.001.001.05.xsd b/account_banking_sepa_credit_transfer/data/pain.001.001.05.xsd new file mode 100644 index 000000000..18bd0cc7c --- /dev/null +++ b/account_banking_sepa_credit_transfer/data/pain.001.001.05.xsd @@ -0,0 +1,931 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/account_banking_sepa_credit_transfer/data/pain.001.003.03.xsd b/account_banking_sepa_credit_transfer/data/pain.001.003.03.xsd new file mode 100644 index 000000000..0c3b51e32 --- /dev/null +++ b/account_banking_sepa_credit_transfer/data/pain.001.003.03.xsd @@ -0,0 +1,474 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + If used, it is recommended to be used at ‘Payment Information’ level and not at ‘Credit Transfer Transaction Information’ level. + + + + + + It is recommended that this element be specified at ‘Payment Information’ level. + + + + + This data element may be present either at ‘Payment Information’ or at ‘Credit Transfer Transaction Information’ level. + + + + + + + + + + + + + + + + If a Creditor Reference contains a check digit, the receiving bank is not required to validate this. +If the receiving bank validates the check digit and if this validation fails, the bank may continue its processing and send the transaction to the next party in the chain. +RF Creditor Reference may be used (ISO 11649). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Either ‘BIC or BEI’ or one +occurrence of ‘Other’ is allowed. + + + + + Either ‘Date and Place of Birth’ or one occurrence of ‘Other’ is allowed. + + + + + + + + + + ‘Name’ is limited to 70 characters +in length. + + + + + + + + + + ‘Name’ is limited to 70 characters +in length. + + + + + + + + + + + + + + + + + + Only ‘TRF’ is allowed. + + + + + If present and contains ‘true’, batch booking is requested. If present and contains ‘false’, booking per transaction is requested. If element is not present, pre-agreed customer-to-bank conditions apply. + + + + + + + If used, it is recommended to be used only at ‘Payment Information’ level and not at Credit Transfer Transaction Information’ level. +When Instruction Priority is to be used, ‘Payment Type Information’ must be present at ‘Payment Information’ level. + + + + + + + + + This data element may be present either at ‘Payment Information’ or at ‘Credit Transfer Transaction Information’ level. + + + + + It is recommended that this element be specified at ‘Payment Information’ level. + + + + + + + + + + + + + + + If present, pre-agreed customer-to-bank conditions apply. + + + + + + Depending on the agreement between the Originator and the Originator Bank, ‘Category Purpose’ may be forwarded to the Beneficiary Bank. + + + + + + + + + + Depending on the agreement between the Originator and the Originator Bank, ‘Category Purpose’ may be forwarded to the Beneficiary Bank. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Only codes from the ISO 20022 ExternalPurposeCode list are allowed. + + + + + + + + + + + + + + + + + + + + + + When present, the receiving bank is not obliged to validate the the reference information. + + + + + + + + + + diff --git a/account_banking_sepa_credit_transfer/demo/sepa_credit_transfer_demo.xml b/account_banking_sepa_credit_transfer/demo/sepa_credit_transfer_demo.xml new file mode 100644 index 000000000..c11d6ff76 --- /dev/null +++ b/account_banking_sepa_credit_transfer/demo/sepa_credit_transfer_demo.xml @@ -0,0 +1,24 @@ + + + + + + SEPA Credit Transfer to suppliers + + variable + + + + + + + + + + + + + + + + diff --git a/account_banking_sepa_credit_transfer/i18n/account_banking_sepa_credit_transfer.pot b/account_banking_sepa_credit_transfer/i18n/account_banking_sepa_credit_transfer.pot new file mode 100644 index 000000000..fdcc3f471 --- /dev/null +++ b/account_banking_sepa_credit_transfer/i18n/account_banking_sepa_credit_transfer.pot @@ -0,0 +1,49 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_banking_sepa_credit_transfer +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.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: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155 +#, python-format +msgid "Bank account is missing on the bank payment line of partner '%s' (reference '%s')." +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:27 +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:61 +#, python-format +msgid "PAIN version '%s' is not supported." +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line +msgid "Payment Lines" +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method +msgid "Payment Methods" +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order +msgid "Payment Order" +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer +#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1 +msgid "SEPA Credit Transfer to suppliers" +msgstr "" + diff --git a/account_banking_sepa_credit_transfer/i18n/de.po b/account_banking_sepa_credit_transfer/i18n/de.po new file mode 100644 index 000000000..656fadca9 --- /dev/null +++ b/account_banking_sepa_credit_transfer/i18n/de.po @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_banking_sepa_credit_transfer +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-11 09:51+0000\n" +"PO-Revision-Date: 2018-11-23 20: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: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155 +#, python-format +msgid "" +"Bank account is missing on the bank payment line of partner '%s' (reference " +"'%s')." +msgstr "" +"Das Bankkonto fehlt auf der Zahlungszeile des Partners '%s' (Referenz '%s')." + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:27 +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:61 +#, python-format +msgid "PAIN version '%s' is not supported." +msgstr "PAIN Version '%s' wird nicht unterstützt." + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line +msgid "Payment Lines" +msgstr "Zahlungszeilen" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method +msgid "Payment Methods" +msgstr "Zahlungsmethoden" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order +msgid "Payment Order" +msgstr "Zahlungsauftrag" + +#. module: account_banking_sepa_credit_transfer +#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer +#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1 +msgid "SEPA Credit Transfer to suppliers" +msgstr "SEPA-Überweisung an Lieferanten" diff --git a/account_banking_sepa_credit_transfer/i18n/es.po b/account_banking_sepa_credit_transfer/i18n/es.po new file mode 100644 index 000000000..a7ba9c0b2 --- /dev/null +++ b/account_banking_sepa_credit_transfer/i18n/es.po @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_banking_sepa_credit_transfer +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-23 03:38+0000\n" +"PO-Revision-Date: 2017-11-23 03:38+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\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: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155 +#, python-format +msgid "" +"Bank account is missing on the bank payment line of partner '%s' (reference " +"'%s')." +msgstr "" +"Falta la cuenta bancaria en la línea de pago de la empresa '%s' (referencia " +"'%s')." + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:27 +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:61 +#, python-format +msgid "PAIN version '%s' is not supported." +msgstr "La versión PAIN '%s' no está soportada." + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line +msgid "Payment Lines" +msgstr "Líneas de pago" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method +msgid "Payment Methods" +msgstr "Métodos de pago" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order +msgid "Payment Order" +msgstr "Orden de pago" + +#. module: account_banking_sepa_credit_transfer +#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer +#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1 +msgid "SEPA Credit Transfer to suppliers" +msgstr "Transferencia de crédito SEPA para proveedores" diff --git a/account_banking_sepa_credit_transfer/i18n/fr.po b/account_banking_sepa_credit_transfer/i18n/fr.po new file mode 100644 index 000000000..b8a07a96d --- /dev/null +++ b/account_banking_sepa_credit_transfer/i18n/fr.po @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_banking_sepa_credit_transfer +# +# Translators: +# Nicolas JEUDY , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-10 02:10+0000\n" +"PO-Revision-Date: 2018-02-10 02:10+0000\n" +"Last-Translator: Nicolas JEUDY , 2018\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" + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155 +#, python-format +msgid "" +"Bank account is missing on the bank payment line of partner '%s' (reference " +"'%s')." +msgstr "" +"Le compte bancaire est manquant sur la ligne de paiement bancaire du " +"partenaire '%s' (référence '%s')." + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:27 +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:61 +#, python-format +msgid "PAIN version '%s' is not supported." +msgstr "PAIN version '%s' n'est pas supporté." + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line +msgid "Payment Lines" +msgstr "Lignes de règlement" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method +msgid "Payment Methods" +msgstr "Methodes de règlement" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order +msgid "Payment Order" +msgstr "Ordre de paiement" + +#. module: account_banking_sepa_credit_transfer +#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer +#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1 +msgid "SEPA Credit Transfer to suppliers" +msgstr "Virement SEPA aux fournisseurs" diff --git a/account_banking_sepa_credit_transfer/i18n/hr.po b/account_banking_sepa_credit_transfer/i18n/hr.po new file mode 100644 index 000000000..88c72d5d8 --- /dev/null +++ b/account_banking_sepa_credit_transfer/i18n/hr.po @@ -0,0 +1,56 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_banking_sepa_credit_transfer +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: bank-payment (10.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-03 00:10+0000\n" +"PO-Revision-Date: 2016-10-19 23:45+0000\n" +"Last-Translator: <>\n" +"Language-Team: Croatian (http://www.transifex.com/oca/OCA-bank-payment-10-0/" +"language/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155 +#, python-format +msgid "" +"Bank account is missing on the bank payment line of partner '%s' (reference " +"'%s')." +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:27 +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:61 +#, python-format +msgid "PAIN version '%s' is not supported." +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line +msgid "Payment Lines" +msgstr "Stavke plaćanja" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method +msgid "Payment Methods" +msgstr "Metode plaćanja" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order +msgid "Payment Order" +msgstr "Nalog za plaćanje" + +#. module: account_banking_sepa_credit_transfer +#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer +#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1 +msgid "SEPA Credit Transfer to suppliers" +msgstr "" diff --git a/account_banking_sepa_credit_transfer/i18n/nb_NO.po b/account_banking_sepa_credit_transfer/i18n/nb_NO.po new file mode 100644 index 000000000..33853e6f2 --- /dev/null +++ b/account_banking_sepa_credit_transfer/i18n/nb_NO.po @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_banking_sepa_credit_transfer +# +# Translators: +# Imre Kristoffer Eilertsen , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-07-30 07:37+0000\n" +"PO-Revision-Date: 2016-07-30 07:37+0000\n" +"Last-Translator: Imre Kristoffer Eilertsen , 2016\n" +"Language-Team: Norwegian Bokmål (Norway) (https://www.transifex.com/oca/" +"teams/23907/nb_NO/)\n" +"Language: nb_NO\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: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155 +#, python-format +msgid "" +"Bank account is missing on the bank payment line of partner '%s' (reference " +"'%s')." +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:27 +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:61 +#, python-format +msgid "PAIN version '%s' is not supported." +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line +#, fuzzy +msgid "Payment Lines" +msgstr "Betalingsordre" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method +msgid "Payment Methods" +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order +msgid "Payment Order" +msgstr "Betalingsordre" + +#. module: account_banking_sepa_credit_transfer +#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer +#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1 +msgid "SEPA Credit Transfer to suppliers" +msgstr "" diff --git a/account_banking_sepa_credit_transfer/i18n/nl.po b/account_banking_sepa_credit_transfer/i18n/nl.po new file mode 100644 index 000000000..9193c713b --- /dev/null +++ b/account_banking_sepa_credit_transfer/i18n/nl.po @@ -0,0 +1,56 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_banking_sepa_credit_transfer +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-23 03:38+0000\n" +"PO-Revision-Date: 2017-11-23 03:38+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n" +"Language: nl\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: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155 +#, python-format +msgid "" +"Bank account is missing on the bank payment line of partner '%s' (reference " +"'%s')." +msgstr "" +"Bankrekening ontbreekt op de betaalregel van relatie '%s' (reference '%s')." + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:27 +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:61 +#, python-format +msgid "PAIN version '%s' is not supported." +msgstr "PAIN versie '%s' is niet ondersteund." + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line +msgid "Payment Lines" +msgstr "Betaalregels" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method +msgid "Payment Methods" +msgstr "Betaalwijzes" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order +msgid "Payment Order" +msgstr "Betalingsopdracht" + +#. module: account_banking_sepa_credit_transfer +#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer +#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1 +msgid "SEPA Credit Transfer to suppliers" +msgstr "SEPA overboeking naar leveranciers" diff --git a/account_banking_sepa_credit_transfer/i18n/pt_BR.po b/account_banking_sepa_credit_transfer/i18n/pt_BR.po new file mode 100644 index 000000000..1ad87dd9e --- /dev/null +++ b/account_banking_sepa_credit_transfer/i18n/pt_BR.po @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_banking_sepa_credit_transfer +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-23 03:38+0000\n" +"PO-Revision-Date: 2017-11-23 03:38+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/pt_BR/)\n" +"Language: pt_BR\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: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155 +#, python-format +msgid "" +"Bank account is missing on the bank payment line of partner '%s' (reference " +"'%s')." +msgstr "" +"Conta bancária está faltando na linha de pagamento do parceiro '%s' (ref. " +"'%s')." + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:27 +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:61 +#, python-format +msgid "PAIN version '%s' is not supported." +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line +msgid "Payment Lines" +msgstr "Linhas do pagamento" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method +msgid "Payment Methods" +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order +msgid "Payment Order" +msgstr "Ordem de Pagamento" + +#. module: account_banking_sepa_credit_transfer +#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer +#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1 +msgid "SEPA Credit Transfer to suppliers" +msgstr "" diff --git a/account_banking_sepa_credit_transfer/i18n/sl.po b/account_banking_sepa_credit_transfer/i18n/sl.po new file mode 100644 index 000000000..15317424e --- /dev/null +++ b/account_banking_sepa_credit_transfer/i18n/sl.po @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_banking_sepa_credit_transfer +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-23 03:38+0000\n" +"PO-Revision-Date: 2017-11-23 03:38+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155 +#, python-format +msgid "" +"Bank account is missing on the bank payment line of partner '%s' (reference " +"'%s')." +msgstr "" +"Pri postavki bančnega plačila partnerja '%s' (sklic '%s') manjka bančni " +"račun." + +#. module: account_banking_sepa_credit_transfer +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:27 +#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:61 +#, python-format +msgid "PAIN version '%s' is not supported." +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line +msgid "Payment Lines" +msgstr "Plačilne postavke" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method +msgid "Payment Methods" +msgstr "" + +#. module: account_banking_sepa_credit_transfer +#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order +msgid "Payment Order" +msgstr "Plačilni nalog" + +#. module: account_banking_sepa_credit_transfer +#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer +#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1 +msgid "SEPA Credit Transfer to suppliers" +msgstr "" diff --git a/account_banking_sepa_credit_transfer/models/__init__.py b/account_banking_sepa_credit_transfer/models/__init__.py new file mode 100644 index 000000000..137fca50c --- /dev/null +++ b/account_banking_sepa_credit_transfer/models/__init__.py @@ -0,0 +1,4 @@ + +from . import account_payment_method +from . import account_payment_order +from . import account_payment_line diff --git a/account_banking_sepa_credit_transfer/models/account_payment_line.py b/account_banking_sepa_credit_transfer/models/account_payment_line.py new file mode 100644 index 000000000..a2fd57286 --- /dev/null +++ b/account_banking_sepa_credit_transfer/models/account_payment_line.py @@ -0,0 +1,15 @@ +# Copyright 2017 Akretion - Alexis de Lattre +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models, fields + + +class AccountPaymentLine(models.Model): + _inherit = 'account.payment.line' + + # local_instrument 'INST' used for instant credit transfers + # which will begin on November 21st 2017, cf + # https://www.europeanpaymentscouncil.eu/document-library/ + # rulebooks/2017-sepa-instant-credit-transfer-rulebook + local_instrument = fields.Selection( + selection_add=[('INST', 'Instant Transfer')]) diff --git a/account_banking_sepa_credit_transfer/models/account_payment_method.py b/account_banking_sepa_credit_transfer/models/account_payment_method.py new file mode 100644 index 000000000..c093be50a --- /dev/null +++ b/account_banking_sepa_credit_transfer/models/account_payment_method.py @@ -0,0 +1,28 @@ +# Copyright 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models, fields, api + + +class AccountPaymentMethod(models.Model): + _inherit = 'account.payment.method' + + pain_version = fields.Selection(selection_add=[ + ('pain.001.001.02', 'pain.001.001.02'), + ('pain.001.001.03', 'pain.001.001.03 ' + '(recommended for credit transfer)'), + ('pain.001.001.04', 'pain.001.001.04'), + ('pain.001.001.05', 'pain.001.001.05'), + ('pain.001.003.03', 'pain.001.003.03 (credit transfer in Germany)'), + ]) + + @api.multi + def get_xsd_file_path(self): + self.ensure_one() + if self.pain_version in [ + 'pain.001.001.02', 'pain.001.001.03', 'pain.001.001.04', + 'pain.001.001.05', 'pain.001.003.03']: + path = 'account_banking_sepa_credit_transfer/data/%s.xsd'\ + % self.pain_version + return path + return super(AccountPaymentMethod, self).get_xsd_file_path() diff --git a/account_banking_sepa_credit_transfer/models/account_payment_order.py b/account_banking_sepa_credit_transfer/models/account_payment_order.py new file mode 100644 index 000000000..3a39862f4 --- /dev/null +++ b/account_banking_sepa_credit_transfer/models/account_payment_order.py @@ -0,0 +1,176 @@ +# Copyright 2010-2016 Akretion (www.akretion.com) +# Copyright 2014-2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import _, api, fields, models +from odoo.exceptions import UserError +from lxml import etree + + +class AccountPaymentOrder(models.Model): + _inherit = 'account.payment.order' + + @api.multi + def generate_payment_file(self): + """Creates the SEPA Credit Transfer file. That's the important code!""" + self.ensure_one() + if self.payment_method_id.code != 'sepa_credit_transfer': + return super(AccountPaymentOrder, self).generate_payment_file() + + pain_flavor = self.payment_method_id.pain_version + # We use pain_flavor.startswith('pain.001.001.xx') + # to support country-specific extensions such as + # pain.001.001.03.ch.02 (cf l10n_ch_sepa) + if not pain_flavor: + raise UserError( + _("PAIN version '%s' is not supported.") % pain_flavor) + if pain_flavor.startswith('pain.001.001.02'): + bic_xml_tag = 'BIC' + name_maxsize = 70 + root_xml_tag = 'pain.001.001.02' + elif pain_flavor.startswith('pain.001.001.03'): + bic_xml_tag = 'BIC' + # size 70 -> 140 for with pain.001.001.03 + # BUT the European Payment Council, in the document + # "SEPA Credit Transfer Scheme Customer-to-bank + # Implementation guidelines" v6.0 available on + # http://www.europeanpaymentscouncil.eu/knowledge_bank.cfm + # says that 'Nm' should be limited to 70 + # so we follow the "European Payment Council" + # and we put 70 and not 140 + name_maxsize = 70 + root_xml_tag = 'CstmrCdtTrfInitn' + elif pain_flavor.startswith('pain.001.001.04'): + bic_xml_tag = 'BICFI' + name_maxsize = 140 + root_xml_tag = 'CstmrCdtTrfInitn' + elif pain_flavor.startswith('pain.001.001.05'): + bic_xml_tag = 'BICFI' + name_maxsize = 140 + root_xml_tag = 'CstmrCdtTrfInitn' + # added pain.001.003.03 for German Banks + # it is not in the offical ISO 20022 documentations, but nearly all + # german banks are working with this instead 001.001.03 + elif pain_flavor == 'pain.001.003.03': + bic_xml_tag = 'BIC' + name_maxsize = 70 + root_xml_tag = 'CstmrCdtTrfInitn' + else: + raise UserError( + _("PAIN version '%s' is not supported.") % pain_flavor) + xsd_file = self.payment_method_id.get_xsd_file_path() + gen_args = { + 'bic_xml_tag': bic_xml_tag, + 'name_maxsize': name_maxsize, + 'convert_to_ascii': self.payment_method_id.convert_to_ascii, + 'payment_method': 'TRF', + 'file_prefix': 'sct_', + 'pain_flavor': pain_flavor, + 'pain_xsd_file': xsd_file, + } + nsmap = self.generate_pain_nsmap() + attrib = self.generate_pain_attrib() + xml_root = etree.Element('Document', nsmap=nsmap, attrib=attrib) + pain_root = etree.SubElement(xml_root, root_xml_tag) + # A. Group header + group_header, nb_of_transactions_a, control_sum_a = \ + self.generate_group_header_block(pain_root, gen_args) + transactions_count_a = 0 + amount_control_sum_a = 0.0 + lines_per_group = {} + # key = (requested_date, priority, local_instrument, categ_purpose) + # values = list of lines as object + for line in self.bank_line_ids: + priority = line.priority + local_instrument = line.local_instrument + categ_purpose = line.category_purpose + # The field line.date is the requested payment date + # taking into account the 'date_prefered' setting + # cf account_banking_payment_export/models/account_payment.py + # in the inherit of action_open() + key = (line.date, priority, local_instrument, categ_purpose) + if key in lines_per_group: + lines_per_group[key].append(line) + else: + lines_per_group[key] = [line] + for (requested_date, priority, local_instrument, categ_purpose),\ + lines in list(lines_per_group.items()): + # B. Payment info + requested_date = fields.Date.to_string(requested_date) + payment_info, nb_of_transactions_b, control_sum_b = \ + self.generate_start_payment_info_block( + pain_root, + "self.name + '-' " + "+ requested_date.replace('-', '') + '-' + priority + " + "'-' + local_instrument + '-' + category_purpose", + priority, local_instrument, categ_purpose, + False, requested_date, { + 'self': self, + 'priority': priority, + 'requested_date': requested_date, + 'local_instrument': local_instrument or 'NOinstr', + 'category_purpose': categ_purpose or 'NOcateg', + }, gen_args) + self.generate_party_block( + payment_info, 'Dbtr', 'B', + self.company_partner_bank_id, gen_args) + charge_bearer = etree.SubElement(payment_info, 'ChrgBr') + if self.sepa: + charge_bearer_text = 'SLEV' + else: + charge_bearer_text = self.charge_bearer + charge_bearer.text = charge_bearer_text + transactions_count_b = 0 + amount_control_sum_b = 0.0 + for line in lines: + transactions_count_a += 1 + transactions_count_b += 1 + # C. Credit Transfer Transaction Info + credit_transfer_transaction_info = etree.SubElement( + payment_info, 'CdtTrfTxInf') + payment_identification = etree.SubElement( + credit_transfer_transaction_info, 'PmtId') + instruction_identification = etree.SubElement( + payment_identification, 'InstrId') + instruction_identification.text = self._prepare_field( + 'Instruction Identification', 'line.name', + {'line': line}, 35, gen_args=gen_args) + end2end_identification = etree.SubElement( + payment_identification, 'EndToEndId') + end2end_identification.text = self._prepare_field( + 'End to End Identification', 'line.name', + {'line': line}, 35, gen_args=gen_args) + currency_name = self._prepare_field( + 'Currency Code', 'line.currency_id.name', + {'line': line}, 3, gen_args=gen_args) + amount = etree.SubElement( + credit_transfer_transaction_info, 'Amt') + instructed_amount = etree.SubElement( + amount, 'InstdAmt', Ccy=currency_name) + instructed_amount.text = '%.2f' % line.amount_currency + amount_control_sum_a += line.amount_currency + amount_control_sum_b += line.amount_currency + if not line.partner_bank_id: + raise UserError( + _("Bank account is missing on the bank payment line " + "of partner '%s' (reference '%s').") + % (line.partner_id.name, line.name)) + self.generate_party_block( + credit_transfer_transaction_info, 'Cdtr', + 'C', line.partner_bank_id, gen_args, line) + if line.purpose: + purpose = etree.SubElement( + credit_transfer_transaction_info, 'Purp') + etree.SubElement(purpose, 'Cd').text = line.purpose + self.generate_remittance_info_block( + credit_transfer_transaction_info, line, gen_args) + if not pain_flavor.startswith('pain.001.001.02'): + nb_of_transactions_b.text = str(transactions_count_b) + control_sum_b.text = '%.2f' % amount_control_sum_b + if not pain_flavor.startswith('pain.001.001.02'): + nb_of_transactions_a.text = str(transactions_count_a) + control_sum_a.text = '%.2f' % amount_control_sum_a + else: + nb_of_transactions_a.text = str(transactions_count_a) + control_sum_a.text = '%.2f' % amount_control_sum_a + return self.finalize_sepa_file_creation(xml_root, gen_args) diff --git a/account_banking_sepa_credit_transfer/post_install.py b/account_banking_sepa_credit_transfer/post_install.py new file mode 100644 index 000000000..5570a35e3 --- /dev/null +++ b/account_banking_sepa_credit_transfer/post_install.py @@ -0,0 +1,18 @@ +# Copyright 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, SUPERUSER_ID + + +def update_bank_journals(cr, registry): + with api.Environment.manage(): + env = api.Environment(cr, SUPERUSER_ID, {}) + ajo = env['account.journal'] + journals = ajo.search([('type', '=', 'bank')]) + sct = env.ref( + 'account_banking_sepa_credit_transfer.sepa_credit_transfer') + if sct: + journals.write({ + 'outbound_payment_method_ids': [(4, sct.id)], + }) + return diff --git a/account_banking_sepa_credit_transfer/readme/CONFIGURE.rst b/account_banking_sepa_credit_transfer/readme/CONFIGURE.rst new file mode 100644 index 000000000..05e8f3b89 --- /dev/null +++ b/account_banking_sepa_credit_transfer/readme/CONFIGURE.rst @@ -0,0 +1,6 @@ +* Create a Payment Mode dedicated to SEPA Credit Transfer. + +* Select the Payment Method *SEPA Credit Transfer to suppliers* (which is + automatically created upon module installation). + +* Check that this payment method uses the proper version of PAIN. diff --git a/account_banking_sepa_credit_transfer/readme/CONTRIBUTORS.rst b/account_banking_sepa_credit_transfer/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..6dd36e660 --- /dev/null +++ b/account_banking_sepa_credit_transfer/readme/CONTRIBUTORS.rst @@ -0,0 +1,12 @@ +* Alexis de Lattre +* Stéphane Bidoul +* Stefan Rijnhart +* Julien Laloux +* Alexandre Fayolle +* Raphaël Valyi +* Erwin van der Ploeg +* Sandy Carter +* `Tecnativa `__: + + * Antonio Espinosa + * Pedro M. Baeza diff --git a/account_banking_sepa_credit_transfer/readme/DESCRIPTION.rst b/account_banking_sepa_credit_transfer/readme/DESCRIPTION.rst new file mode 100644 index 000000000..b03032d82 --- /dev/null +++ b/account_banking_sepa_credit_transfer/readme/DESCRIPTION.rst @@ -0,0 +1,16 @@ +Module to export payment orders in SEPA XML file format. + +SEPA PAIN (PAyment INitiation) is the new european standard for +Customer-to-Bank payment instructions. This module implements SEPA Credit +Transfer (SCT), more specifically PAIN versions 001.001.02, 001.001.03, +001.001.04 and 001.001.05. It is part of the ISO 20022 standard, available on +https://www.iso20022.org. + +The Implementation Guidelines for SEPA Credit Transfer published by the +European Payments Council (https://www.europeanpaymentscouncil.eu) use +PAIN version 001.001.03, so it's probably the version of PAIN that you should +try first. + +It also includes pain.001.003.03 which is used in Germany instead of 001.001.03. +You can read more about this here (only in german language): +http://www.ebics.de/startseite/ diff --git a/account_banking_sepa_credit_transfer/readme/INSTALL.rst b/account_banking_sepa_credit_transfer/readme/INSTALL.rst new file mode 100644 index 000000000..6c1bc3922 --- /dev/null +++ b/account_banking_sepa_credit_transfer/readme/INSTALL.rst @@ -0,0 +1,4 @@ +This module depends on : +* account_banking_pain_base + +This module is part of the OCA/bank-payment suite. diff --git a/account_banking_sepa_credit_transfer/readme/USAGE.rst b/account_banking_sepa_credit_transfer/readme/USAGE.rst new file mode 100644 index 000000000..cdd729aed --- /dev/null +++ b/account_banking_sepa_credit_transfer/readme/USAGE.rst @@ -0,0 +1,3 @@ +In the menu *Invoicing/Accounting > Payments > Payment Order*, create a new +payment order and select the Payment Mode dedicated to SEPA Credit +Transfer that you created during the configuration step. diff --git a/account_banking_sepa_credit_transfer/static/description/icon.png b/account_banking_sepa_credit_transfer/static/description/icon.png new file mode 100644 index 000000000..e1485aabd Binary files /dev/null and b/account_banking_sepa_credit_transfer/static/description/icon.png differ diff --git a/account_banking_sepa_credit_transfer/static/description/icon.svg b/account_banking_sepa_credit_transfer/static/description/icon.svg new file mode 100644 index 000000000..266ef8442 --- /dev/null +++ b/account_banking_sepa_credit_transfer/static/description/icon.svg @@ -0,0 +1,92 @@ + + + +image/svg+xmlCREDITTRANSFER + \ No newline at end of file diff --git a/account_banking_sepa_credit_transfer/static/description/index.html b/account_banking_sepa_credit_transfer/static/description/index.html new file mode 100644 index 000000000..3705cf20e --- /dev/null +++ b/account_banking_sepa_credit_transfer/static/description/index.html @@ -0,0 +1,468 @@ + + + + + + +Account Banking SEPA Credit Transfer + + + +
+

Account Banking SEPA Credit Transfer

+ + +

Beta License: AGPL-3 OCA/bank-payment Translate me on Weblate Try me on Runbot

+

Module to export payment orders in SEPA XML file format.

+

SEPA PAIN (PAyment INitiation) is the new european standard for +Customer-to-Bank payment instructions. This module implements SEPA Credit +Transfer (SCT), more specifically PAIN versions 001.001.02, 001.001.03, +001.001.04 and 001.001.05. It is part of the ISO 20022 standard, available on +https://www.iso20022.org.

+

The Implementation Guidelines for SEPA Credit Transfer published by the +European Payments Council (https://www.europeanpaymentscouncil.eu) use +PAIN version 001.001.03, so it’s probably the version of PAIN that you should +try first.

+

It also includes pain.001.003.03 which is used in Germany instead of 001.001.03. +You can read more about this here (only in german language): +http://www.ebics.de/startseite/

+

Table of contents

+ +
+

Installation

+

This module depends on : +* account_banking_pain_base

+

This module is part of the OCA/bank-payment suite.

+
+
+

Configuration

+
    +
  • Create a Payment Mode dedicated to SEPA Credit Transfer.
  • +
  • Select the Payment Method SEPA Credit Transfer to suppliers (which is +automatically created upon module installation).
  • +
  • Check that this payment method uses the proper version of PAIN.
  • +
+
+
+

Usage

+

In the menu Invoicing/Accounting > Payments > Payment Order, create a new +payment order and select the Payment Mode dedicated to SEPA Credit +Transfer that you created during the configuration step.

+
+
+

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
  • +
  • Tecnativa
  • +
+
+
+

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/bank-payment project on GitHub.

+

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

+
+
+
+ + diff --git a/account_banking_sepa_credit_transfer/tests/__init__.py b/account_banking_sepa_credit_transfer/tests/__init__.py new file mode 100644 index 000000000..8b95a582a --- /dev/null +++ b/account_banking_sepa_credit_transfer/tests/__init__.py @@ -0,0 +1,2 @@ + +from . import test_sct diff --git a/account_banking_sepa_credit_transfer/tests/test_sct.py b/account_banking_sepa_credit_transfer/tests/test_sct.py new file mode 100644 index 000000000..f2547d5b2 --- /dev/null +++ b/account_banking_sepa_credit_transfer/tests/test_sct.py @@ -0,0 +1,297 @@ +# Copyright 2016 Akretion (Alexis de Lattre ) +# Copyright 2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import base64 +from odoo.exceptions import UserError +from odoo.tools import float_compare +from odoo.tests import common +import time +from lxml import etree + + +class TestSCT(common.HttpCase): + + def setUp(self): + super(TestSCT, self).setUp() + self.account_model = self.env['account.account'] + self.move_model = self.env['account.move'] + self.journal_model = self.env['account.journal'] + self.payment_order_model = self.env['account.payment.order'] + self.payment_line_model = self.env['account.payment.line'] + self.bank_line_model = self.env['bank.payment.line'] + self.partner_bank_model = self.env['res.partner.bank'] + self.attachment_model = self.env['ir.attachment'] + self.invoice_model = self.env['account.invoice'] + self.invoice_line_model = self.env['account.invoice.line'] + self.partner_agrolait = self.env.ref('base.res_partner_2') + self.partner_asus = self.env.ref('base.res_partner_1') + self.partner_c2c = self.env.ref('base.res_partner_12') + self.eur_currency = self.env.ref('base.EUR') + self.usd_currency = self.env.ref('base.USD') + self.main_company = self.env['res.company'].create({ + 'name': 'Test EUR company', + 'currency_id': self.eur_currency.id, + }) + self.partner_agrolait.company_id = self.main_company.id + self.partner_asus.company_id = self.main_company.id + self.partner_c2c.company_id = self.main_company.id + self.env.user.write({ + 'company_ids': [(6, 0, self.main_company.ids)], + 'company_id': self.main_company.id, + }) + self.env.ref( + 'l10n_generic_coa.configurable_chart_template' + ).try_loading_for_current_company() + self.account_expense = self.account_model.search([ + ('user_type_id', '=', + self.env.ref('account.data_account_type_expenses').id), + ('company_id', '=', self.main_company.id), + ], limit=1) + self.account_payable = self.account_model.search([ + ('user_type_id', '=', + self.env.ref('account.data_account_type_payable').id), + ('company_id', '=', self.main_company.id), + ], limit=1) + self.partner_bank = self.env.ref( + 'account_payment_mode.main_company_iban' + ).copy({ + 'company_id': self.main_company.id, + 'partner_id': self.main_company.partner_id.id, + 'bank_id': ( + self.env.ref('account_payment_mode.bank_la_banque_postale').id + ), + }) + # create journal + self.bank_journal = self.journal_model.create({ + 'name': 'Company Bank journal', + 'type': 'bank', + 'code': 'BNKFB', + 'bank_account_id': self.partner_bank.id, + 'bank_id': self.partner_bank.bank_id.id, + }) + # update payment mode + self.payment_mode = self.env.ref( + 'account_banking_sepa_credit_transfer.' + 'payment_mode_outbound_sepa_ct1' + ).copy({ + 'company_id': self.main_company.id, + }) + self.payment_mode.write({ + 'bank_account_link': 'fixed', + 'fixed_journal_id': self.bank_journal.id, + }) + # Trigger the recompute of account type on res.partner.bank + self.partner_bank_model.search([])._compute_acc_type() + + def test_no_pain(self): + self.payment_mode.payment_method_id.pain_version = False + with self.assertRaises(UserError): + self.check_eur_currency_sct() + + def test_pain_001_03(self): + self.payment_mode.payment_method_id.pain_version = 'pain.001.001.03' + self.check_eur_currency_sct() + + def test_pain_001_04(self): + self.payment_mode.payment_method_id.pain_version = 'pain.001.001.04' + self.check_eur_currency_sct() + + def test_pain_001_05(self): + self.payment_mode.payment_method_id.pain_version = 'pain.001.001.05' + self.check_eur_currency_sct() + + def test_pain_003_03(self): + self.payment_mode.payment_method_id.pain_version = 'pain.001.003.03' + self.check_eur_currency_sct() + + def check_eur_currency_sct(self): + invoice1 = self.create_invoice( + self.partner_agrolait.id, + 'account_payment_mode.res_partner_2_iban', self.eur_currency.id, + 42.0, 'F1341') + invoice2 = self.create_invoice( + self.partner_agrolait.id, + 'account_payment_mode.res_partner_2_iban', self.eur_currency.id, + 12.0, 'F1342') + invoice3 = self.create_invoice( + self.partner_agrolait.id, + 'account_payment_mode.res_partner_2_iban', self.eur_currency.id, + 5.0, 'A1301', 'in_refund') + invoice4 = self.create_invoice( + self.partner_c2c.id, + 'account_payment_mode.res_partner_12_iban', self.eur_currency.id, + 11.0, 'I1642') + invoice5 = self.create_invoice( + self.partner_c2c.id, + 'account_payment_mode.res_partner_12_iban', self.eur_currency.id, + 41.0, 'I1643') + for inv in [invoice1, invoice2, invoice3, invoice4, invoice5]: + action = inv.create_account_payment_line() + self.assertEqual(action['res_model'], 'account.payment.order') + self.payment_order = self.payment_order_model.browse(action['res_id']) + self.assertEqual( + self.payment_order.payment_type, 'outbound') + self.assertEqual( + self.payment_order.payment_mode_id, self.payment_mode) + self.assertEqual( + self.payment_order.journal_id, self.bank_journal) + pay_lines = self.payment_line_model.search([ + ('partner_id', '=', self.partner_agrolait.id), + ('order_id', '=', self.payment_order.id)]) + self.assertEqual(len(pay_lines), 3) + agrolait_pay_line1 = pay_lines[0] + accpre = self.env['decimal.precision'].precision_get('Account') + self.assertEqual(agrolait_pay_line1.currency_id, self.eur_currency) + self.assertEqual( + agrolait_pay_line1.partner_bank_id, invoice1.partner_bank_id) + self.assertEqual(float_compare( + agrolait_pay_line1.amount_currency, 42, precision_digits=accpre), + 0) + self.assertEqual(agrolait_pay_line1.communication_type, 'normal') + self.assertEqual(agrolait_pay_line1.communication, 'F1341') + self.payment_order.draft2open() + self.assertEqual(self.payment_order.state, 'open') + self.assertEqual(self.payment_order.sepa, True) + bank_lines = self.bank_line_model.search([ + ('partner_id', '=', self.partner_agrolait.id)]) + self.assertEqual(len(bank_lines), 1) + agrolait_bank_line = bank_lines[0] + self.assertEqual(agrolait_bank_line.currency_id, self.eur_currency) + self.assertEqual(float_compare( + agrolait_bank_line.amount_currency, 49.0, precision_digits=accpre), + 0) + self.assertEqual(agrolait_bank_line.communication_type, 'normal') + self.assertEqual( + agrolait_bank_line.communication, 'F1341-F1342-A1301') + self.assertEqual( + agrolait_bank_line.partner_bank_id, invoice1.partner_bank_id) + + action = self.payment_order.open2generated() + self.assertEqual(self.payment_order.state, 'generated') + self.assertEqual(action['res_model'], 'ir.attachment') + attachment = self.attachment_model.browse(action['res_id']) + self.assertEqual(attachment.datas_fname[-4:], '.xml') + xml_file = base64.b64decode(attachment.datas) + xml_root = etree.fromstring(xml_file) + namespaces = xml_root.nsmap + namespaces['p'] = xml_root.nsmap[None] + namespaces.pop(None) + pay_method_xpath = xml_root.xpath( + '//p:PmtInf/p:PmtMtd', namespaces=namespaces) + self.assertEqual(pay_method_xpath[0].text, 'TRF') + sepa_xpath = xml_root.xpath( + '//p:PmtInf/p:PmtTpInf/p:SvcLvl/p:Cd', namespaces=namespaces) + self.assertEqual(sepa_xpath[0].text, 'SEPA') + debtor_acc_xpath = xml_root.xpath( + '//p:PmtInf/p:DbtrAcct/p:Id/p:IBAN', namespaces=namespaces) + self.assertEqual( + debtor_acc_xpath[0].text, + self.payment_order.company_partner_bank_id.sanitized_acc_number) + self.payment_order.generated2uploaded() + self.assertEqual(self.payment_order.state, 'uploaded') + for inv in [invoice1, invoice2, invoice3, invoice4, invoice5]: + self.assertEqual(inv.state, 'paid') + return + + def test_usd_currency_sct(self): + invoice1 = self.create_invoice( + self.partner_asus.id, + 'account_payment_mode.res_partner_2_iban', self.usd_currency.id, + 2042.0, 'Inv9032') + invoice2 = self.create_invoice( + self.partner_asus.id, + 'account_payment_mode.res_partner_2_iban', self.usd_currency.id, + 1012.0, 'Inv9033') + for inv in [invoice1, invoice2]: + action = inv.create_account_payment_line() + self.assertEqual(action['res_model'], 'account.payment.order') + self.payment_order = self.payment_order_model.browse(action['res_id']) + self.assertEqual( + self.payment_order.payment_type, 'outbound') + self.assertEqual( + self.payment_order.payment_mode_id, self.payment_mode) + self.assertEqual( + self.payment_order.journal_id, self.bank_journal) + pay_lines = self.payment_line_model.search([ + ('partner_id', '=', self.partner_asus.id), + ('order_id', '=', self.payment_order.id)]) + self.assertEqual(len(pay_lines), 2) + asus_pay_line1 = pay_lines[0] + accpre = self.env['decimal.precision'].precision_get('Account') + self.assertEqual(asus_pay_line1.currency_id, self.usd_currency) + self.assertEqual( + asus_pay_line1.partner_bank_id, invoice1.partner_bank_id) + self.assertEqual(float_compare( + asus_pay_line1.amount_currency, 2042, precision_digits=accpre), + 0) + self.assertEqual(asus_pay_line1.communication_type, 'normal') + self.assertEqual(asus_pay_line1.communication, 'Inv9032') + self.payment_order.draft2open() + self.assertEqual(self.payment_order.state, 'open') + self.assertEqual(self.payment_order.sepa, False) + bank_lines = self.bank_line_model.search([ + ('partner_id', '=', self.partner_asus.id)]) + self.assertEqual(len(bank_lines), 1) + asus_bank_line = bank_lines[0] + self.assertEqual(asus_bank_line.currency_id, self.usd_currency) + self.assertEqual(float_compare( + asus_bank_line.amount_currency, 3054.0, precision_digits=accpre), + 0) + self.assertEqual(asus_bank_line.communication_type, 'normal') + self.assertEqual( + asus_bank_line.communication, 'Inv9032-Inv9033') + self.assertEqual( + asus_bank_line.partner_bank_id, invoice1.partner_bank_id) + + action = self.payment_order.open2generated() + self.assertEqual(self.payment_order.state, 'generated') + self.assertEqual(action['res_model'], 'ir.attachment') + attachment = self.attachment_model.browse(action['res_id']) + self.assertEqual(attachment.datas_fname[-4:], '.xml') + xml_file = base64.b64decode(attachment.datas) + xml_root = etree.fromstring(xml_file) + namespaces = xml_root.nsmap + namespaces['p'] = xml_root.nsmap[None] + namespaces.pop(None) + pay_method_xpath = xml_root.xpath( + '//p:PmtInf/p:PmtMtd', namespaces=namespaces) + self.assertEqual(pay_method_xpath[0].text, 'TRF') + sepa_xpath = xml_root.xpath( + '//p:PmtInf/p:PmtTpInf/p:SvcLvl/p:Cd', namespaces=namespaces) + self.assertEqual(len(sepa_xpath), 0) + debtor_acc_xpath = xml_root.xpath( + '//p:PmtInf/p:DbtrAcct/p:Id/p:IBAN', namespaces=namespaces) + self.assertEqual( + debtor_acc_xpath[0].text, + self.payment_order.company_partner_bank_id.sanitized_acc_number) + self.payment_order.generated2uploaded() + self.assertEqual(self.payment_order.state, 'uploaded') + for inv in [invoice1, invoice2]: + self.assertEqual(inv.state, 'paid') + return + + def create_invoice( + self, partner_id, partner_bank_xmlid, currency_id, + price_unit, reference, type='in_invoice'): + invoice = self.invoice_model.create({ + 'partner_id': partner_id, + 'reference_type': 'none', + 'reference': reference, + 'currency_id': currency_id, + 'name': 'test', + 'account_id': self.account_payable.id, + 'type': type, + 'date_invoice': time.strftime('%Y-%m-%d'), + 'payment_mode_id': self.payment_mode.id, + 'partner_bank_id': self.env.ref(partner_bank_xmlid).id, + }) + self.invoice_line_model.create({ + 'invoice_id': invoice.id, + 'price_unit': price_unit, + 'quantity': 1, + 'name': 'Great service', + 'account_id': self.account_expense.id, + }) + invoice.action_invoice_open() + return invoice diff --git a/account_payment_partner/models/account_invoice.py b/account_payment_partner/models/account_invoice.py index 791ea10ff..95622bcb4 100644 --- a/account_payment_partner/models/account_invoice.py +++ b/account_payment_partner/models/account_invoice.py @@ -117,6 +117,14 @@ class AccountInvoice(models.Model): _("The company of the invoice %s does not match " "with that of the payment mode") % rec.name) + @api.constrains('partner_id', 'partner_bank_id') + def validate_partner_bank_id(self): + """Inhibit the validation of the bank account by default, as core + rules are not the expected one for the bank-payment suite. + """ + if self.env.context.get('use_old_partner_bank_id_check'): + super().validate_partner_bank_id() + def partner_banks_to_show(self): self.ensure_one() if self.partner_bank_id: