Skip to content

Commit

Permalink
Merge PR #589 into 18.0
Browse files Browse the repository at this point in the history
Signed-off-by alexis-via
  • Loading branch information
OCA-git-bot committed Dec 1, 2024
2 parents f40ce4e + 91211c4 commit eb331f8
Show file tree
Hide file tree
Showing 18 changed files with 745 additions and 0 deletions.
105 changes: 105 additions & 0 deletions l10n_fr_hr_check_ssnid/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
==================================================
French Localization - Check Social Security Number
==================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:eacb3f41a35a03bd39149b39593ff365efadd6e7b5c7647be962901a57f010c9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
:target: https://odoo-community.org/page/development-status
:alt: Mature
.. |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--france-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-france/tree/18.0/l10n_fr_hr_check_ssnid
:alt: OCA/l10n-france
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-france-18-0/l10n-france-18-0-l10n_fr_hr_check_ssnid
: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-france&target_branch=18.0
:alt: Try me on Runboat

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

With this module, the social security number of employees of French
companies will be checked: if the length or checksum is wrong, an error
message will be displayed.

**Table of contents**

.. contents::
:local:

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

This module require the Python
`stdnum <https://arthurdejong.org/python-stdnum/>`__ library. To install
it, run:

::

pip3 install python-stdnum

Usage
=====

Check that the country of the company is **France**. Go to the menu
*Employees > Employees*, select an employee. In the tab *Private
Information*, enter the French social security number in the field *SSN
No*.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-france/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-france/issues/new?body=module:%20l10n_fr_hr_check_ssnid%0Aversion:%2018.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 <[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-alexis-via| image:: https://github.com/alexis-via.png?size=40px
:target: https://github.com/alexis-via
:alt: alexis-via

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

|maintainer-alexis-via|

This module is part of the `OCA/l10n-france <https://github.com/OCA/l10n-france/tree/18.0/l10n_fr_hr_check_ssnid>`_ 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_fr_hr_check_ssnid/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions l10n_fr_hr_check_ssnid/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2018-2020 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "French Localization - Check Social Security Number",
"version": "18.0.1.0.0",
"category": "Human Resources",
"development_status": "Mature",
"license": "AGPL-3",
"summary": "Check validity of Social Security Numbers in French companies",
"author": "Akretion,Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
"website": "https://github.com/OCA/l10n-france",
"depends": ["hr"],
"external_dependencies": {"python": ["python-stdnum"]},
"installable": True,
}
29 changes: 29 additions & 0 deletions l10n_fr_hr_check_ssnid/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_fr_hr_check_ssnid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-02-16 21:34+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\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.17\n"

#. module: l10n_fr_hr_check_ssnid
#: model:ir.model,name:l10n_fr_hr_check_ssnid.model_hr_employee
msgid "Employee"
msgstr "Empleado/a"

#. module: l10n_fr_hr_check_ssnid
#. odoo-python
#: code:addons/l10n_fr_hr_check_ssnid/models/hr_employee.py:0
#, python-format
msgid "The French Social Security Number '%(ssnid)s' is invalid. (%(e)s)"
msgstr "El número de seguridad social francés '%(ssnid)s' no es válido. (%(e)s)"
33 changes: 33 additions & 0 deletions l10n_fr_hr_check_ssnid/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_fr_hr_check_ssnid
#
# Translators:
# Quentin THEURET <[email protected]>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-21 08:47+0000\n"
"PO-Revision-Date: 2023-06-20 16:08+0000\n"
"Last-Translator: Alexis de Lattre <[email protected]>\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: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: l10n_fr_hr_check_ssnid
#: model:ir.model,name:l10n_fr_hr_check_ssnid.model_hr_employee
msgid "Employee"
msgstr "Employé"

#. module: l10n_fr_hr_check_ssnid
#. odoo-python
#: code:addons/l10n_fr_hr_check_ssnid/models/hr_employee.py:0
#, python-format
msgid "The French Social Security Number '%(ssnid)s' is invalid. (%(e)s)"
msgstr ""
"Le numéro de sécurité sociale français '%(ssnid)s' est invalide. (%(e)s)"
26 changes: 26 additions & 0 deletions l10n_fr_hr_check_ssnid/i18n/l10n_fr_hr_check_ssnid.pot
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:
# * l10n_fr_hr_check_ssnid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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_fr_hr_check_ssnid
#: model:ir.model,name:l10n_fr_hr_check_ssnid.model_hr_employee
msgid "Employee"
msgstr ""

#. module: l10n_fr_hr_check_ssnid
#. odoo-python
#: code:addons/l10n_fr_hr_check_ssnid/models/hr_employee.py:0
#, python-format
msgid "The French Social Security Number '%(ssnid)s' is invalid. (%(e)s)"
msgstr ""
1 change: 1 addition & 0 deletions l10n_fr_hr_check_ssnid/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import hr_employee
47 changes: 47 additions & 0 deletions l10n_fr_hr_check_ssnid/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2018-2020 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging

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

logger = logging.getLogger(__name__)

try:
from stdnum.fr.nir import InvalidChecksum, InvalidFormat, InvalidLength, validate
except ImportError:
logger.debug("Cannot import stdnum")


class HrEmployee(models.Model):
_inherit = "hr.employee"

@api.constrains("ssnid")
def _check_france_ssnid(self):
fr_country_codes = (
"FR",
"GP",
"MQ",
"GF",
"RE",
"YT",
"PF",
"PM",
"MF",
"BL",
"NC",
)
for empl in self:
if empl.company_id.country_id.code in fr_country_codes and empl.ssnid:
try:
validate(empl.ssnid)
except (InvalidFormat, InvalidLength, InvalidChecksum) as e:
raise ValidationError(
_(
"The French Social Security Number '%(ssnid)s' "
"is invalid. %(e)s"
)
% {"ssnid": empl.ssnid, "e": e}
) from e
3 changes: 3 additions & 0 deletions l10n_fr_hr_check_ssnid/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions l10n_fr_hr_check_ssnid/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Alexis de Lattre \<<[email protected]>\>
3 changes: 3 additions & 0 deletions l10n_fr_hr_check_ssnid/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
With this module, the social security number of employees of French
companies will be checked: if the length or checksum is wrong, an error
message will be displayed.
7 changes: 7 additions & 0 deletions l10n_fr_hr_check_ssnid/readme/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module require the Python
[stdnum](https://arthurdejong.org/python-stdnum/) library. To install
it, run:

```
pip3 install python-stdnum
```
4 changes: 4 additions & 0 deletions l10n_fr_hr_check_ssnid/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Check that the country of the company is **France**. Go to the menu
*Employees \> Employees*, select an employee. In the tab *Private
Information*, enter the French social security number in the field *SSN
No*.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eb331f8

Please sign in to comment.