Skip to content

Commit

Permalink
[11.0][ADD]l10n_be_iso20022_pain
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-demeyer committed Nov 12, 2019
1 parent d9ed327 commit 16abcd0
Show file tree
Hide file tree
Showing 12 changed files with 392 additions and 0 deletions.
64 changes: 64 additions & 0 deletions l10n_be_iso20022_pain/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==================================
ISO 20022 PAIN Support for Belgium
==================================

This module adds Belgium-specific support to OCA/bank-payment/account_payment_order.

* support of the BBA structured communication type [1]

Reference information can be found in
* https://www.febelfin.be/fr/paiements/directives-et-protocoles-standards-bancaires
* https://www.febelfin.be/nl/betaalverkeer/richtlijnen-en-protocollen-bankstandaarden
* [1] https://www.febelfin.be/sites/default/files/Payments/AOS-OGMVCS.pdf

Installation
============

There is nothing specific to do to install this module,
except having the dependent modules available in your addon path.

It is recommended to install l10n_be_invoice_bba, and you will
probably want to use account_banking_sepa_credit_transfer and/or
account_banking_sepa_direct_debit.

Usage
=====

This module adds a new 'Belgium BBA' communication types on payment lines.
When adding invoices to payment orders, invoices having this BBA communication type
automatically put the correct communication type on payment lines. Generated
PAIN files then use the correct communication type.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Stéphane Bidoul <[email protected]>
* Thomas Binsfeld <[email protected]>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit https://odoo-community.org.

1 change: 1 addition & 0 deletions l10n_be_iso20022_pain/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions l10n_be_iso20022_pain/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'ISO 20022 PAIN Support for Belgium',
'summary': """
This module adds Belgium-specific support to account_payment_order.""",
'version': '11.0.1.0.0',
'license': 'AGPL-3',
'author': 'ACSONE SA/NV,Noviat,Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/l10n-belgium',
'depends': [
'account_payment_order',
'l10n_be_invoice_bba',
],
'installable': True,
}
41 changes: 41 additions & 0 deletions l10n_be_iso20022_pain/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_be_iso20022_pain
#
# Translators:
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-20 01:41+0000\n"
"PO-Revision-Date: 2017-12-20 01:41+0000\n"
"Last-Translator: OCA Transbot <[email protected]>, 2017\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: l10n_be_iso20022_pain
#: code:addons/l10n_be_iso20022_pain/models/account_payment_line.py:16
#, python-format
msgid "BBA Structured Communication"
msgstr "Communication Structurée"

#. module: l10n_be_iso20022_pain
#: code:addons/l10n_be_iso20022_pain/models/account_payment_line.py:39
#, python-format
msgid "Invalid BBA Structured Communication !"
msgstr "Communication Structurée invalide !"

#. module: l10n_be_iso20022_pain
#: model:ir.model,name:l10n_be_iso20022_pain.model_account_move_line
msgid "Journal Item"
msgstr "Écriture comptable"

#. module: l10n_be_iso20022_pain
#: model:ir.model,name:l10n_be_iso20022_pain.model_account_payment_line
msgid "Payment Lines"
msgstr "Lignes de paiement"
37 changes: 37 additions & 0 deletions l10n_be_iso20022_pain/i18n/l10n_be_iso20022_pain.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_be_iso20022_pain
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: l10n_be_iso20022_pain
#: code:addons/l10n_be_iso20022_pain/models/account_payment_line.py:16
#, python-format
msgid "BBA Structured Communication"
msgstr ""

#. module: l10n_be_iso20022_pain
#: code:addons/l10n_be_iso20022_pain/models/account_payment_line.py:39
#, python-format
msgid "Invalid BBA Structured Communication !"
msgstr ""

#. module: l10n_be_iso20022_pain
#: model:ir.model,name:l10n_be_iso20022_pain.model_account_move_line
msgid "Journal Item"
msgstr ""

#. module: l10n_be_iso20022_pain
#: model:ir.model,name:l10n_be_iso20022_pain.model_account_payment_line
msgid "Payment Lines"
msgstr ""

3 changes: 3 additions & 0 deletions l10n_be_iso20022_pain/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import account_invoice
from . import account_payment_line
from . import account_move_line
23 changes: 23 additions & 0 deletions l10n_be_iso20022_pain/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2009-2019 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models, _


class AccountInvoice(models.Model):
_inherit = 'account.invoice'

reference_type = fields.Selection(
selection='_selection_reference_type')

@api.model
def _selection_reference_type(self):
"""
This field is defined in the two 'depends' modules with inconsistency
on selection list.
TODO: make PR towards OCA account_payment_order to fix conflict
"""
return [
('none', _('Free Communication')),
('bba', _('BBA Structured Communication')),
('structured', _('Structured Reference'))]
18 changes: 18 additions & 0 deletions l10n_be_iso20022_pain/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models


class AccountMoveLine(models.Model):
_inherit = 'account.move.line'

@api.multi
def _prepare_payment_line_vals(self, payment_order):
self.ensure_one()
vals = super(AccountMoveLine, self).\
_prepare_payment_line_vals(payment_order)
if 'communication' in vals and self.invoice_id.reference_type == 'bba':
vals['communication'] =\
self.invoice_id.reference.replace('+', '').replace('/', '')
return vals
45 changes: 45 additions & 0 deletions l10n_be_iso20022_pain/models/account_payment_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import re

from odoo import api, fields, models, _
from odoo.exceptions import ValidationError


class AccountPaymentLine(models.Model):
_inherit = 'account.payment.line'

communication_type = fields.Selection(
selection_add=[
('bba', _('BBA Structured Communication')),
],
)

@api.model
def check_bbacomm(self, val):
supported_chars = '0-9'
pattern = re.compile('[^' + supported_chars + ']')
if pattern.findall(val or ''):
return False
if len(val) == 12:
base = int(val[:10])
mod = base % 97 or 97
if mod == int(val[-2:]):
return True
return False

@api.multi
@api.constrains('communication', 'communication_type')
def _check_communication(self):
for rec in self:
if rec.communication_type == 'bba'and \
not self.check_bbacomm(rec.communication):
raise ValidationError(_(
"Invalid BBA Structured Communication !"))

def invoice_reference_type2communication_type(self):
res = super(AccountPaymentLine, self)\
.invoice_reference_type2communication_type()
res['bba'] = 'bba'
return res
Binary file added l10n_be_iso20022_pain/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions l10n_be_iso20022_pain/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_l10n_be_iso20022_pain
Loading

0 comments on commit 16abcd0

Please sign in to comment.