-
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from Eficent/12.0-mig-base_ubl_payment
[12.0][MIG] base_ubl_payment
- Loading branch information
Showing
9 changed files
with
633 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/12.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-12-0/edi-12-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/12.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 <https://github.com/OCA/edi/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 <https://github.com/OCA/edi/issues/new?body=module:%20base_ubl_payment%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Akretion | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Alexis de Lattre <alexis.delattre@akretion.com> | ||
* Andrea Stirpe <a.stirpe@onestein.nl> | ||
|
||
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 <https://github.com/OCA/edi/tree/12.0/base_ubl_payment>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# © 2016-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'Base UBL Payment', | ||
'version': '12.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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import ubl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# © 2016-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, models, _ | ||
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.strftime('%Y-%m-%d') | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Alexis de Lattre <alexis.delattre@akretion.com> | ||
* Andrea Stirpe <a.stirpe@onestein.nl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
Oops, something went wrong.