diff --git a/ext/custom-addons/base_ubl_payment/README.rst b/ext/custom-addons/base_ubl_payment/README.rst new file mode 100644 index 00000000..3105c306 --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/README.rst @@ -0,0 +1,79 @@ +================ +Base UBL Payment +================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fedi-lightgray.png?logo=github + :target: https://github.com/OCA/edi/tree/11.0/base_ubl_payment + :alt: OCA/edi +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/edi-11-0/edi-11-0-base_ubl_payment + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/226/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is a small module above the *base_ubl* module; +it adds the generation of the *PaymentMeans* UBL block. +I decided to make it a separate module because it depends +on the module *account_payment_unece* which itself depend on +*account_banking_payment_export*, and I didn't want to add +these dependencies on the *base_ubl* module. + +**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 + +Contributors +~~~~~~~~~~~~ + +* Alexis de Lattre +* Andrea Stirpe + +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/edi `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/ext/custom-addons/base_ubl_payment/__init__.py b/ext/custom-addons/base_ubl_payment/__init__.py new file mode 100644 index 00000000..31660d6a --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/ext/custom-addons/base_ubl_payment/__manifest__.py b/ext/custom-addons/base_ubl_payment/__manifest__.py new file mode 100644 index 00000000..2a95bbd6 --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/__manifest__.py @@ -0,0 +1,17 @@ +# © 2016-2017 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + 'name': 'Base UBL Payment', + 'version': '11.0.1.0.0', + 'category': 'Hidden', + 'license': 'AGPL-3', + 'summary': 'Payment-related code for Universal Business Language (UBL)', + 'author': 'Akretion,Odoo Community Association (OCA)', + 'website': 'https://github.com/oca/edi/', + 'depends': [ + 'account_payment_unece', + 'base_ubl', + ], + 'installable': True, +} diff --git a/ext/custom-addons/base_ubl_payment/i18n/base_ubl_payment.pot b/ext/custom-addons/base_ubl_payment/i18n/base_ubl_payment.pot new file mode 100644 index 00000000..da0d4405 --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/i18n/base_ubl_payment.pot @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_ubl_payment +# +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: base_ubl_payment +#: model:ir.model,name:base_ubl_payment.model_base_ubl +msgid "Common methods to generate and parse UBL XML files" +msgstr "" + +#. module: base_ubl_payment +#: code:addons/base_ubl_payment/models/ubl.py:25 +#, python-format +msgid "Missing 'UNECE Payment Mean' on payment type '%s' used by the payment mode '%s'." +msgstr "" + diff --git a/ext/custom-addons/base_ubl_payment/i18n/nl_NL.po b/ext/custom-addons/base_ubl_payment/i18n/nl_NL.po new file mode 100644 index 00000000..371a8303 --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/i18n/nl_NL.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_ubl_payment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-04-30 14:03+0000\n" +"Last-Translator: Cas Vissers \n" +"Language-Team: none\n" +"Language: nl_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" +"X-Generator: Weblate 3.5.1\n" + +#. module: base_ubl_payment +#: model:ir.model,name:base_ubl_payment.model_base_ubl +msgid "Common methods to generate and parse UBL XML files" +msgstr "Algemene methoden voor het genereren en parsen van UBL XML-bestanden" + +#. module: base_ubl_payment +#: code:addons/base_ubl_payment/models/ubl.py:25 +#, python-format +msgid "Missing 'UNECE Payment Mean' on payment type '%s' used by the payment mode '%s'." +msgstr "" +"Missend 'UNECE betaalmethode' op betalingstype '%s' gebruikt door " +"betalingsmethode '%s'." diff --git a/ext/custom-addons/base_ubl_payment/models/__init__.py b/ext/custom-addons/base_ubl_payment/models/__init__.py new file mode 100644 index 00000000..7ec1c77b --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import ubl diff --git a/ext/custom-addons/base_ubl_payment/models/ubl.py b/ext/custom-addons/base_ubl_payment/models/ubl.py new file mode 100644 index 00000000..08662566 --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/models/ubl.py @@ -0,0 +1,72 @@ +# © 2016-2017 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models, api, _ +from odoo.exceptions import UserError +from lxml import etree +import logging + +logger = logging.getLogger(__name__) + + +class BaseUbl(models.AbstractModel): + _inherit = 'base.ubl' + + @api.model + def _ubl_add_payment_means( + self, partner_bank, payment_mode, date_due, parent_node, ns, + payment_identifier=None, version='2.1'): + pay_means = etree.SubElement(parent_node, ns['cac'] + 'PaymentMeans') + pay_means_code = etree.SubElement( + pay_means, ns['cbc'] + 'PaymentMeansCode', listID="UN/ECE 4461") + # Why not schemeAgencyID='6' + schemeID + if payment_mode: # type is a required field on payment_mode + if not payment_mode.payment_method_id.unece_id: + raise UserError(_( + "Missing 'UNECE Payment Mean' on payment type '%s' " + "used by the payment mode '%s'.") % ( + payment_mode.payment_method_id.name, payment_mode.name)) + pay_means_code.text = payment_mode.payment_method_id.unece_code + else: + pay_means_code.text = '31' + logger.warning( + 'Missing payment mode on invoice ID %d. ' + 'Using 31 (wire transfer) as UNECE code as fallback ' + 'for payment mean', self.id) + if date_due: + pay_due_date = etree.SubElement( + pay_means, ns['cbc'] + 'PaymentDueDate') + pay_due_date.text = date_due + if pay_means_code.text in ['30', '31', '42']: + if ( + not partner_bank and + payment_mode and + payment_mode.bank_account_link == 'fixed' and + payment_mode.fixed_journal_id): + partner_bank = payment_mode.fixed_journal_id.bank_account_id + if partner_bank and partner_bank.acc_type == 'iban': + # In the Chorus specs, they except 'IBAN' in PaymentChannelCode + # I don't know if this usage is common or not + payment_channel_code = etree.SubElement( + pay_means, ns['cbc'] + 'PaymentChannelCode') + payment_channel_code.text = 'IBAN' + if payment_identifier: + payment_id = etree.SubElement( + pay_means, ns['cbc'] + 'PaymentID') + payment_id.text = payment_identifier + payee_fin_account = etree.SubElement( + pay_means, ns['cac'] + 'PayeeFinancialAccount') + payee_fin_account_id = etree.SubElement( + payee_fin_account, ns['cbc'] + 'ID', schemeName='IBAN') + payee_fin_account_id.text =\ + partner_bank.sanitized_acc_number + if partner_bank.bank_bic: + financial_inst_branch = etree.SubElement( + payee_fin_account, + ns['cac'] + 'FinancialInstitutionBranch') + financial_inst = etree.SubElement( + financial_inst_branch, + ns['cac'] + 'FinancialInstitution') + financial_inst_id = etree.SubElement( + financial_inst, ns['cbc'] + 'ID', schemeName='BIC') + financial_inst_id.text = partner_bank.bank_bic diff --git a/ext/custom-addons/base_ubl_payment/readme/CONTRIBUTORS.rst b/ext/custom-addons/base_ubl_payment/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..1befc121 --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Alexis de Lattre +* Andrea Stirpe diff --git a/ext/custom-addons/base_ubl_payment/readme/DESCRIPTION.rst b/ext/custom-addons/base_ubl_payment/readme/DESCRIPTION.rst new file mode 100644 index 00000000..eeed096d --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +This module is a small module above the *base_ubl* module; +it adds the generation of the *PaymentMeans* UBL block. +I decided to make it a separate module because it depends +on the module *account_payment_unece* which itself depend on +*account_banking_payment_export*, and I didn't want to add +these dependencies on the *base_ubl* module. diff --git a/ext/custom-addons/base_ubl_payment/static/description/icon.png b/ext/custom-addons/base_ubl_payment/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/ext/custom-addons/base_ubl_payment/static/description/icon.png differ diff --git a/ext/custom-addons/base_ubl_payment/static/description/index.html b/ext/custom-addons/base_ubl_payment/static/description/index.html new file mode 100644 index 00000000..1adf4823 --- /dev/null +++ b/ext/custom-addons/base_ubl_payment/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +Base UBL Payment + + + +
+

Base UBL Payment

+ + +

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

+

This module is a small module above the base_ubl module; +it adds the generation of the PaymentMeans UBL block. +I decided to make it a separate module because it depends +on the module account_payment_unece which itself depend on +account_banking_payment_export, and I didn’t want to add +these dependencies on the base_ubl module.

+

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

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

+

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

+
+
+
+ +