Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] l10n_be_iso20022_pain #204

Open
wants to merge 25 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
01624ac
[ADD] l10n_be_iso20022_pain
sbidoul Dec 14, 2014
1ab8e10
Add bug tracker link on README.rst
yvaucher May 22, 2015
220e3ea
OCA Transbot updated translations from Transifex
lmignon Aug 28, 2015
2ec4b0f
[UPD] prefix versions with 8.0
sbidoul Oct 9, 2015
bce90c0
[MIG] Make modules uninstallable
pedrobaeza Oct 14, 2015
affe0ba
[FIX] remove en.po that was erroneously created by transbot
sbidoul Aug 10, 2016
48514f0
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
1e5192c
[MIG] 10n_be_iso20022_pain to 9.0
ThomasBinsfeld Aug 30, 2016
d875aa3
[FIX] l10n_be_iso20022: translation of selection field
ThomasBinsfeld Oct 3, 2017
f07ce47
[ADD] l10_be_iso20022_pain: french translation
ThomasBinsfeld Oct 3, 2017
d1f99ed
[MIG] l10n_be_iso20022_pain to 10.0
ThomasBinsfeld Oct 3, 2017
c93b39f
[FIX] header underline in readme
sbidoul Dec 4, 2017
fe32b66
[FIX] l10n_be_iso20022_pain: test was really broken, fixed
sbidoul Dec 4, 2017
4832c81
OCA Transbot updated translations from Transifex
oca-transbot Dec 30, 2017
27e089a
remove obsolete .pot files [ci skip]
sbidoul Jun 15, 2018
0fc18bf
[UPD] Update l10n_be_iso20022_pain.pot
oca-travis Jun 18, 2018
019db49
[ADD] icon.png
OCA-git-bot Apr 3, 2019
1d4e10a
[MIG] l10n_be_iso20022_pain: run pre-commit
ThomasBinsfeld Nov 12, 2020
f230b1c
[MIG] l10n_be_iso20022_pain to 13.0
ThomasBinsfeld Nov 12, 2020
e075ead
[UPD] Update l10n_be_iso20022_pain.pot
Feb 18, 2022
ba14450
l10n_be_iso20022_pain 13.0.1.0.1
OCA-git-bot Feb 18, 2022
ac00220
Update translation files
oca-transbot Feb 18, 2022
d2ebb70
[16.0][MIG] l10n_be_iso20022_pain
sbejaoui Sep 21, 2023
f65c848
[IMP] remove bba option from communication_type on payment line
sbejaoui Jul 9, 2024
ec5fae3
[IMP] l10n_be_iso20022_pain: check BBA structured communication on pa…
sbejaoui Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions l10n_be_iso20022_pain/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
==================================
ISO 20022 PAIN Support for Belgium
==================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1cff3d36ccb17d6f1c923cf7cde8f56ab567dd8c0b3b44eb496c8885ca0fd623
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--belgium-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-belgium/tree/16.0/l10n_be_iso20022_pain
:alt: OCA/l10n-belgium
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-belgium-16-0/l10n-belgium-16-0-l10n_be_iso20022_pain
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-belgium&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

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

**Table of contents**

.. contents::
:local:

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

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

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.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-belgium/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-belgium/issues/new?body=module:%20l10n_be_iso20022_pain%0Aversion:%2016.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
~~~~~~~

* ACSONE SA/NV

Contributors
~~~~~~~~~~~~

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

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

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

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

This module is part of the `OCA/l10n-belgium <https://github.com/OCA/l10n-belgium/tree/16.0/l10n_be_iso20022_pain>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
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
15 changes: 15 additions & 0 deletions l10n_be_iso20022_pain/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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": "16.0.1.0.2",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-belgium",
"depends": ["account_payment_order", "l10n_be"],
"installable": True,
"data": ["views/account_journal.xml"],
}
69 changes: 69 additions & 0 deletions l10n_be_iso20022_pain/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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: 2021-03-26 09:36+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:0
#: model:ir.model.fields.selection,name:l10n_be_iso20022_pain.selection__account_move__reference_type__bba
#: model:ir.model.fields.selection,name:l10n_be_iso20022_pain.selection__account_payment_line__communication_type__bba
#, python-format
msgid "BBA Structured Communication"
msgstr "Communication Structurée"

#. module: l10n_be_iso20022_pain
#: model:ir.model.fields,field_description:l10n_be_iso20022_pain.field_account_payment_line__communication_type
msgid "Communication Type"
msgstr "Type de communication"

#. module: l10n_be_iso20022_pain
#: code:addons/l10n_be_iso20022_pain/models/account_move.py:0
#, python-format
msgid ""
"Empty BBA Structured Communication! Please fill in a unique BBA Structured "
"Communication."
msgstr ""
"La communication BBA est vide ! Veuillez insérer une communication BBA "
"unique."

#. module: l10n_be_iso20022_pain
#: code:addons/l10n_be_iso20022_pain/models/account_payment_line.py:0
#, 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
#, fuzzy
msgid "Journal Entries"
msgstr "Écriture comptable"

#. 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"

#. module: l10n_be_iso20022_pain
#: model:ir.model.fields,field_description:l10n_be_iso20022_pain.field_account_move__reference_type
msgid "Reference Type"
msgstr "Type de communication"
61 changes: 61 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,61 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_be_iso20022_pain
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.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:0
#: model:ir.model.fields.selection,name:l10n_be_iso20022_pain.selection__account_move__reference_type__bba
#: model:ir.model.fields.selection,name:l10n_be_iso20022_pain.selection__account_payment_line__communication_type__bba
#, python-format
msgid "BBA Structured Communication"
msgstr ""

#. module: l10n_be_iso20022_pain
#: model:ir.model.fields,field_description:l10n_be_iso20022_pain.field_account_payment_line__communication_type
msgid "Communication Type"
msgstr ""

#. module: l10n_be_iso20022_pain
#: code:addons/l10n_be_iso20022_pain/models/account_move.py:0
#, python-format
msgid ""
"Empty BBA Structured Communication! Please fill in a unique BBA Structured "
"Communication."
msgstr ""

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

#. module: l10n_be_iso20022_pain
#: model:ir.model,name:l10n_be_iso20022_pain.model_account_move
msgid "Journal Entries"
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 ""

#. module: l10n_be_iso20022_pain
#: model:ir.model.fields,field_description:l10n_be_iso20022_pain.field_account_move__reference_type
msgid "Reference Type"
msgstr ""
12 changes: 12 additions & 0 deletions l10n_be_iso20022_pain/migrations/16.0.1.0.2/pre-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2024 ACSONE SA/NV


def migrate(cr, version):
cr.execute(
"UPDATE account_move SET reference_type='structured' "
"WHERE reference_type='bba'"
)
cr.execute(
"UPDATE account_payment_line SET communication_type='structured' "
"WHERE communication_type='bba'"
)
2 changes: 2 additions & 0 deletions l10n_be_iso20022_pain/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_payment_line
from . import account_move_line
40 changes: 40 additions & 0 deletions l10n_be_iso20022_pain/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import re

from odoo import api, models


def check_bbacomm(val):
supported_chars = "0-9+*/ "
pattern = re.compile("[^" + supported_chars + "]")
if pattern.findall(val or ""):
return False

Check warning on line 13 in l10n_be_iso20022_pain/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_be_iso20022_pain/models/account_move.py#L13

Added line #L13 was not covered by tests
bbacomm = re.sub(r"\D", "", val or "")
if len(bbacomm) == 12:
base = int(bbacomm[:10])
mod = base % 97 or 97
if mod == int(bbacomm[-2:]):
return True
return False


class AccountMove(models.Model):
_inherit = "account.move"

@api.constrains("reference_type", "ref")
def _check_communication(self):
for rec in self:
if (
rec.journal_id.invoice_reference_model == "be"
and rec.journal_id.invoice_reference_type == "invoice"
and rec.reference_type == "structured"
):
return check_bbacomm(rec.ref)

Check warning on line 34 in l10n_be_iso20022_pain/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_be_iso20022_pain/models/account_move.py#L34

Added line #L34 was not covered by tests
Copy link
Member

@sbidoul sbidoul Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not use rec.payment_reference here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least for vendor bills, where ref is the supplier invoice number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not use rec.payment_reference here?

yes

Copy link
Contributor Author

@sbejaoui sbejaoui Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least for vendor bills, where ref is the supplier invoice number?

only for out_invoice, and don't check for VB


def _get_invoice_reference_be_invoice(self):
self.ensure_one()

Check warning on line 37 in l10n_be_iso20022_pain/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_be_iso20022_pain/models/account_move.py#L37

Added line #L37 was not covered by tests
if self.reference_type == "none":
return ""
return super()._get_invoice_reference_be_invoice()

Check warning on line 40 in l10n_be_iso20022_pain/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_be_iso20022_pain/models/account_move.py#L39-L40

Added lines #L39 - L40 were not covered by tests
15 changes: 15 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,15 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


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

def _get_communication(self):
self.ensure_one()
communication_type, communication = super()._get_communication()
if self.move_id.reference_type == "structured":
communication = communication.replace("+", "").replace("/", "")
return communication_type, communication
22 changes: 22 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,22 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

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

from .account_move import check_bbacomm


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

@api.constrains("order_id", "communication", "communication_type")
def _check_communication(self):
for rec in self:
if (
rec.order_id.journal_id.invoice_reference_type == "invoice"
and rec.order_id.journal_id.invoice_reference_model == "be"
and rec.communication_type == "structured"
and not check_bbacomm(rec.communication)
):
raise ValidationError(_("Invalid BBA Structured Communication !"))
3 changes: 3 additions & 0 deletions l10n_be_iso20022_pain/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Stéphane Bidoul <[email protected]>
* Thomas Binsfeld <[email protected]>
* Souheil Bejaoui <[email protected]>
8 changes: 8 additions & 0 deletions l10n_be_iso20022_pain/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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
Empty file.
5 changes: 5 additions & 0 deletions l10n_be_iso20022_pain/readme/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
There is nothing specific to do to install this module,
except having the dependent modules available in your addon path.

You will probably want to use account_banking_sepa_credit_transfer and/or
account_banking_sepa_direct_debit.
4 changes: 4 additions & 0 deletions l10n_be_iso20022_pain/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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.
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.
Loading
Loading