Skip to content

Commit

Permalink
Merge PR #379 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by hbrunn
  • Loading branch information
OCA-git-bot committed Feb 12, 2024
2 parents c356ef4 + 86fea54 commit e7568aa
Show file tree
Hide file tree
Showing 17 changed files with 921 additions and 0 deletions.
100 changes: 100 additions & 0 deletions l10n_nl_oin/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
=====================================
Organisatie-identificatienummer (OIN)
=====================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fl10n--netherlands-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-netherlands/tree/14.0/l10n_nl_oin
:alt: OCA/l10n-netherlands
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-netherlands-14-0/l10n-netherlands-14-0-l10n_nl_oin
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/176/14.0
:alt: Try me on Runbot

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

This module validates the Dutch `Organisatie-identificatienummer (OIN)` field
on partner forms.

The field is visible when the field ``company_type`` is set to ``Company``
and when the Country is ``The Netherlands``.

A double check on the OIN is done when inserting/modifying its value:

- validation of the OIN (check whether the format is correct);
- check if another partner with the same OIN already exists.

In both cases, a non-blocking alert is shown.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

* Open a form of a contact: flag Company must be checked (flag "Individual" must be unchecked)
* Enter the OIN number

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-netherlands/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/l10n-netherlands/issues/new?body=module:%20l10n_nl_oin%0Aversion:%2014.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
~~~~~~~

* Onestein

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

* Andrea Stirpe <[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.

.. |maintainer-astirpe| image:: https://github.com/astirpe.png?size=40px
:target: https://github.com/astirpe
:alt: astirpe

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-astirpe|

This module is part of the `OCA/l10n-netherlands <https://github.com/OCA/l10n-netherlands/tree/14.0/l10n_nl_oin>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions l10n_nl_oin/__init__.py
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
15 changes: 15 additions & 0 deletions l10n_nl_oin/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2020 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Organisatie-identificatienummer (OIN)",
"version": "16.0.1.0.0",
"category": "Dutch Localization",
"license": "AGPL-3",
"summary": "Adds Dutch OIN field",
"author": "Onestein, Odoo Community Association (OCA)",
"maintainers": ["astirpe"],
"website": "https://github.com/OCA/l10n-netherlands",
"depends": ["l10n_nl"],
"installable": True,
}
71 changes: 71 additions & 0 deletions l10n_nl_oin/i18n/l10n_nl_oin.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_nl_oin
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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_nl_oin
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#, python-format
msgid "Another partner (%s) has the same OIN (%s)."
msgstr ""

#. module: l10n_nl_oin
#: model:ir.model,name:l10n_nl_oin.model_res_partner
msgid "Contact"
msgstr ""

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__display_name
msgid "Display Name"
msgstr ""

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_users__nl_oin
msgid "Dutch OIN"
msgstr ""

#. module: l10n_nl_oin
#: model:ir.model.fields,help:l10n_nl_oin.field_res_partner__nl_oin
#: model:ir.model.fields,help:l10n_nl_oin.field_res_users__nl_oin
msgid "Dutch Organisatie-identificatienummer (OIN)"
msgstr ""

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__id
msgid "ID"
msgstr ""

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner____last_update
msgid "Last Modified on"
msgstr ""

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__nl_oin_display
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_users__nl_oin_display
msgid "Nl Oin Display"
msgstr ""

#. module: l10n_nl_oin
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#, python-format
msgid "The OIN you entered (%s) is not valid."
msgstr ""

#. module: l10n_nl_oin
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#, python-format
msgid "Warning!"
msgstr ""
74 changes: 74 additions & 0 deletions l10n_nl_oin/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_nl_oin
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-03-03 09:45+0000\n"
"Last-Translator: Cas Vissers <[email protected]>\n"
"Language-Team: none\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"
"X-Generator: Weblate 4.3.2\n"

#. module: l10n_nl_oin
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#, python-format
msgid "Another partner (%s) has the same OIN (%s)."
msgstr "Een andere relatie (%s) heeft dezelfde OIN (%s)."

#. module: l10n_nl_oin
#: model:ir.model,name:l10n_nl_oin.model_res_partner
msgid "Contact"
msgstr "Contact"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__display_name
msgid "Display Name"
msgstr "Weergave naam"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_users__nl_oin
msgid "Dutch OIN"
msgstr "Nederlands OIN"

#. module: l10n_nl_oin
#: model:ir.model.fields,help:l10n_nl_oin.field_res_partner__nl_oin
#: model:ir.model.fields,help:l10n_nl_oin.field_res_users__nl_oin
msgid "Dutch Organisatie-identificatienummer (OIN)"
msgstr "Nederlands Organisatie Identificatie Nummer (OIN)"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__id
msgid "ID"
msgstr "ID"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner____last_update
msgid "Last Modified on"
msgstr "Laatst gewijzigd op"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__nl_oin_display
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_users__nl_oin_display
msgid "Nl Oin Display"
msgstr "Nl OIN weergave"

#. module: l10n_nl_oin
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#, python-format
msgid "The OIN you entered (%s) is not valid."
msgstr "De ingevoerde OIN (%s) is ongeldig."

#. module: l10n_nl_oin
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#, python-format
msgid "Warning!"
msgstr "Let op!"
74 changes: 74 additions & 0 deletions l10n_nl_oin/i18n/nl_NL.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_nl_oin
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-03-03 09:45+0000\n"
"Last-Translator: Cas Vissers <[email protected]>\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 4.3.2\n"

#. module: l10n_nl_oin
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#, python-format
msgid "Another partner (%s) has the same OIN (%s)."
msgstr "Een andere relatie (%s) heeft dezelfde OIN (%s)."

#. module: l10n_nl_oin
#: model:ir.model,name:l10n_nl_oin.model_res_partner
msgid "Contact"
msgstr "Contact"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__display_name
msgid "Display Name"
msgstr "Weergave naam"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_users__nl_oin
msgid "Dutch OIN"
msgstr "Nederlands OIN"

#. module: l10n_nl_oin
#: model:ir.model.fields,help:l10n_nl_oin.field_res_partner__nl_oin
#: model:ir.model.fields,help:l10n_nl_oin.field_res_users__nl_oin
msgid "Dutch Organisatie-identificatienummer (OIN)"
msgstr "Nederlands Organisatie Identificatie Nummer (OIN)"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__id
msgid "ID"
msgstr "ID"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner____last_update
msgid "Last Modified on"
msgstr "Laatst gewijzigd op"

#. module: l10n_nl_oin
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_partner__nl_oin_display
#: model:ir.model.fields,field_description:l10n_nl_oin.field_res_users__nl_oin_display
msgid "Nl Oin Display"
msgstr "Nl OIN weergave"

#. module: l10n_nl_oin
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#, python-format
msgid "The OIN you entered (%s) is not valid."
msgstr "De ingevoerde OIN (%s) is ongeldig."

#. module: l10n_nl_oin
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#: code:addons/l10n_nl_oin/models/res_partner.py:0
#, python-format
msgid "Warning!"
msgstr "Let op!"
3 changes: 3 additions & 0 deletions l10n_nl_oin/models/__init__.py
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 res_partner
52 changes: 52 additions & 0 deletions l10n_nl_oin/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2020 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

l10n_nl_oin = fields.Char(
copy=False, help="Dutch Organisatie-identificatienummer (OIN)"
)

@api.onchange("l10n_nl_oin")
def onchange_nl_oin(self):
warning = {}
if self.l10n_nl_oin:
# check is valid, otherwise display a warning
warning = self._warn_oin_invalid()

# search for another partner with the same OIN
args = [("l10n_nl_oin", "=", self.l10n_nl_oin), ("name", "!=", self.name)]

# refine search in case of multicompany setting
if self.company_id:
args += [("company_id", "=", self.company_id.id)]
other_partner = self.search(args, limit=1)

# if another partner exists, display a warning
if other_partner:
warning = other_partner._warn_oin_existing()
return {"warning": warning}

def _warn_oin_invalid(self):
self.ensure_one()
warning = {}
if len(self.l10n_nl_oin) != 20 or not self.l10n_nl_oin.isdigit():
msg = _("The OIN you entered (%(oin)s) is not valid.")
warning = {
"title": _("Warning!"),
"message": msg % {"oin": self.l10n_nl_oin},
}
return warning

def _warn_oin_existing(self):
self.ensure_one()
msg = _("Another partner (%(name)s) has the same OIN (%(oin)s).")
warning = {
"title": _("Warning!"),
"message": msg % {"name": self.name, "oin": self.l10n_nl_oin},
}
return warning
Loading

0 comments on commit e7568aa

Please sign in to comment.