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

[18.0][MIG] l10n_fr_hr_check_ssnid #589

Open
wants to merge 34 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
23ba605
Add module l10n_fr_hr_check_ssnid
alexis-via Feb 28, 2018
06f17b7
l10n_fr_hr_check_ssnid: Use the stdnum lib
alexis-via Mar 1, 2018
524c3bf
Fix python lib name
alexis-via Mar 1, 2018
bacdc50
Fix lib name in external_dependencies
alexis-via Mar 1, 2018
3f5f7f9
Filter exceptions raised by stdnum
alexis-via Mar 8, 2018
14aa1fe
OCA Transbot updated translations from Transifex
oca-transbot Apr 14, 2018
b3d4750
[UPD] Update l10n_fr_hr_check_ssnid.pot
oca-travis Jun 22, 2018
03e77be
[ADD] icon.png
OCA-git-bot Apr 3, 2019
e352baa
[MIG] l10n_fr_hr_check_ssnid from v10 to v14
alexis-via Oct 9, 2020
6ee3f90
l10n_fr_hr_check_ssnid: black, isort and all that stuff
alexis-via Oct 9, 2020
14a343d
[UPD] README.rst
OCA-git-bot Oct 15, 2020
fbe0569
[IMP] update dotfiles [ci skip]
OCA-git-bot Nov 1, 2020
07b5f0c
[UPD] Update l10n_fr_hr_check_ssnid.pot
oca-travis Aug 10, 2021
0b122f4
Update translation files
oca-transbot Aug 10, 2021
7126397
Restore tests and remove Alpha status
alexis-via Sep 1, 2021
7331123
[UPD] README.rst
OCA-git-bot Sep 2, 2021
3d54c90
l10n_fr_hr_check_ssnid 14.0.1.0.1
OCA-git-bot Sep 2, 2021
8efc93b
[MIG] l10n_fr_hr_check_ssnid: Migration to 16.0
syera94 Oct 21, 2022
6a46ad5
[TRANS] l10n_fr_hr_check_ssnid: fr
syera94 Oct 21, 2022
246f789
[UPD] Update l10n_fr_hr_check_ssnid.pot
Nov 3, 2022
a20a85d
[UPD] README.rst
OCA-git-bot Nov 3, 2022
31f2e96
Update translation files
weblate Nov 3, 2022
f17a18b
[UPD] Update l10n_fr_hr_check_ssnid.pot
Nov 24, 2022
46a25a7
Update translation files
weblate Nov 24, 2022
2ab25b2
Translated using Weblate (French)
Jun 20, 2023
5245a3f
[UPD] README.rst
OCA-git-bot Sep 3, 2023
0efe3a5
[IMP] l10n_fr_hr_check_ssnid: pre-commit auto fixes
youelEl Jan 4, 2024
c5c3011
[MIG] l10n_fr_hr_check_ssnid: Migration to 17.0
youelEl Jan 4, 2024
db0ea43
[UPD] Update l10n_fr_hr_check_ssnid.pot
Jan 19, 2024
e4148d1
[BOT] post-merge updates
OCA-git-bot Jan 19, 2024
d79d9dc
Added translation using Weblate (Spanish)
Ivorra78 Feb 16, 2024
3f39f63
Translated using Weblate (Spanish)
Ivorra78 Feb 16, 2024
0c4b7ea
[IMP] l10n_fr_hr_check_ssnid: pre-commit auto fixes for v18 migration
alexis-via Nov 26, 2024
91211c4
[MIG] l10n_fr_hr_check_ssnid to v18
alexis-via Nov 26, 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
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")

Check warning on line 15 in l10n_fr_hr_check_ssnid/models/hr_employee.py

View check run for this annotation

Codecov / codecov/patch

l10n_fr_hr_check_ssnid/models/hr_employee.py#L14-L15

Added lines #L14 - L15 were not covered by tests


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
Loading