Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
14 changes: 11 additions & 3 deletions l10n_it_fiscalcode/README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

====================
ITA - Codice fiscale
====================
Expand All @@ -13,7 +17,7 @@ ITA - Codice fiscale
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/license-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--italy-lightgray.png?logo=github
Expand Down Expand Up @@ -46,11 +50,13 @@ Installation

**Italiano**

Installare il modulo Python: `codicefiscale <https://pypi.python.org/pypi/codicefiscale>`__.
Installare i moduli Python: `codicefiscale <https://pypi.python.org/pypi/codicefiscale>`__
e `python-stdnum <https://pypi.org/project/python-stdnum>`__.

**English**

Install the Python package: `codicefiscale <https://pypi.python.org/pypi/codicefiscale>`__.
Install the Python packages: `codicefiscale <https://pypi.python.org/pypi/codicefiscale>`__
and `python-stdnum <https://pypi.org/project/python-stdnum>`__.

Usage
=====
Expand Down Expand Up @@ -105,6 +111,8 @@ Contributors
* Simone Rubino <simone.rubino@aion-tech.it>
* Ooops404 <https://www.ooops404.com>
* Eduard Brahas <eduardbrhas@outlook.it>
* Phi srl <https://www.phi.technology>
* Marco Colombo <marco.colombo@phi.technology>

Maintainers
~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion l10n_it_fiscalcode/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "AGPL-3",
"depends": ["base_vat"],
"external_dependencies": {
"python": ["codicefiscale"],
"python": ["codicefiscale", "python-stdnum"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Questa libreria è già compresa tra i requirements di Odoo (https://github.com/odoo/odoo/blob/cc0060e889603eb2e47fa44a8a22a70d7d784185/requirements.txt#L55), la puoi rimuovere da qui (e dalle modifiche a INSTALL) così vediamo se funziona tutto lo stesso?

},
"data": [
"security/ir.model.access.csv",
Expand Down
4 changes: 2 additions & 2 deletions l10n_it_fiscalcode/model/res_partner.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Puoi togliere la versione dal titolo del commit? Attualmente è
Image

Il commit deve seguire https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#71commit-message

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2024 Simone Rubino - Aion Tech
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from codicefiscale import isvalid
from stdnum.it.codicefiscale import is_valid

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
Expand Down Expand Up @@ -30,7 +30,7 @@ def check_fiscalcode(self):
# Check fiscalcode length of a person
msg = _("The fiscal code must have 16 characters.")
raise ValidationError(msg)
if not isvalid(partner.fiscalcode):
if not is_valid(partner.fiscalcode):
# Check fiscalcode validity
msg = _("The fiscal code isn't valid.")
raise ValidationError(msg)
Expand Down
2 changes: 2 additions & 0 deletions l10n_it_fiscalcode/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
* Simone Rubino <simone.rubino@aion-tech.it>
* Ooops404 <https://www.ooops404.com>
* Eduard Brahas <eduardbrhas@outlook.it>
* Phi srl <https://www.phi.technology>
* Marco Colombo <marco.colombo@phi.technology>
6 changes: 4 additions & 2 deletions l10n_it_fiscalcode/readme/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
**Italiano**

Installare il modulo Python: `codicefiscale <https://pypi.python.org/pypi/codicefiscale>`__.
Installare i moduli Python: `codicefiscale <https://pypi.python.org/pypi/codicefiscale>`__
e `python-stdnum <https://pypi.org/project/python-stdnum>`__.

**English**

Install the Python package: `codicefiscale <https://pypi.python.org/pypi/codicefiscale>`__.
Install the Python packages: `codicefiscale <https://pypi.python.org/pypi/codicefiscale>`__
and `python-stdnum <https://pypi.org/project/python-stdnum>`__.
47 changes: 30 additions & 17 deletions l10n_it_fiscalcode/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>ITA - Codice fiscale</title>
<title>README.rst</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -359,16 +360,21 @@
</style>
</head>
<body>
<div class="document" id="ita-codice-fiscale">
<h1 class="title">ITA - Codice fiscale</h1>
<div class="document">


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="ita-codice-fiscale">
<h1>ITA - Codice fiscale</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0aa1bac82b773740f26746eb096cf6cb40a54ecb65e3c3db3764a2826861aa05
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fiscalcode"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fiscalcode"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fiscalcode"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fiscalcode"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><strong>Italiano</strong></p>
<p>Questo modulo aggiunge al partner il campo codice fiscale e permette di calcolarne il suo valore.</p>
<p><strong>English</strong></p>
Expand All @@ -388,40 +394,42 @@ <h1 class="title">ITA - Codice fiscale</h1>
</ul>
</div>
<div class="section" id="installation">
<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
<h2><a class="toc-backref" href="#toc-entry-1">Installation</a></h2>
<p><strong>Italiano</strong></p>
<p>Installare il modulo Python: <a class="reference external" href="https://pypi.python.org/pypi/codicefiscale">codicefiscale</a>.</p>
<p>Installare i moduli Python: <a class="reference external" href="https://pypi.python.org/pypi/codicefiscale">codicefiscale</a>
e <a class="reference external" href="https://pypi.org/project/python-stdnum">python-stdnum</a>.</p>
<p><strong>English</strong></p>
<p>Install the Python package: <a class="reference external" href="https://pypi.python.org/pypi/codicefiscale">codicefiscale</a>.</p>
<p>Install the Python packages: <a class="reference external" href="https://pypi.python.org/pypi/codicefiscale">codicefiscale</a>
and <a class="reference external" href="https://pypi.org/project/python-stdnum">python-stdnum</a>.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<p><strong>Italiano</strong></p>
<p>Sulla scheda del partner fare clic sul pulsante <em>Calcola CF</em> per aprire la procedura guidata relativa al calcolo
del codice fiscale.</p>
<p><strong>English</strong></p>
<p>Go to Partner and click “Compute FC” in order to open the wizard related to the fiscal code computation.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fiscalcode%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<ul class="simple">
<li>Link IT s.r.l.</li>
<li>Apulia Software</li>
<li>Odoo Italia Network</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<ul class="simple">
<li>Davide Corio</li>
<li>Luca Subiaco &lt;<a class="reference external" href="mailto:subluca&#64;gmail.com">subluca&#64;gmail.com</a>&gt;</li>
Expand All @@ -441,12 +449,16 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
* Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;aion-tech.it">simone.rubino&#64;aion-tech.it</a>&gt;</li>
<li>Ooops404 &lt;<a class="reference external" href="https://www.ooops404.com">https://www.ooops404.com</a>&gt;
* Eduard Brahas &lt;<a class="reference external" href="mailto:eduardbrhas&#64;outlook.it">eduardbrhas&#64;outlook.it</a>&gt;</li>
<li>Phi srl &lt;<a class="reference external" href="https://www.phi.technology">https://www.phi.technology</a>&gt;
* Marco Colombo &lt;<a class="reference external" href="mailto:marco.colombo&#64;phi.technology">marco.colombo&#64;phi.technology</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
Expand All @@ -455,5 +467,6 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
</div>
</div>
</div>
</div>
</body>
</html>
13 changes: 8 additions & 5 deletions l10n_it_fiscalcode/tests/test_fiscalcode.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright 2024 Simone Rubino - Aion Tech
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from codicefiscale import isvalid

from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
Expand Down Expand Up @@ -34,6 +33,14 @@ def test_fiscalcode_compute(self):
self.assertEqual(self.partner.fiscalcode, "RSSMRA84H04H501X")

def test_fiscalcode_check(self):
# Omocodia
self.env["res.partner"].create(
{
"name": "Person",
"is_company": False,
"fiscalcode": "RSSMRA70A01Z50QQ",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confermo che con il vecchio metodo questo falliva:

>>> from codicefiscale import isvalid
>>> isvalid("RSSMRA70A01Z50QQ")
False

Il codice non è valido per l'AdE (https://telemanagrafici.agenziaentrate.gov.it/VerificaCF/Scegli.do?parameter=verificaCf) solo perché non esiste, ma come mi hai spiegato la struttura è corretta perché ha una lettera invece di un numero nella penultima posizione
👍

}
)
# Wrong FC length
with self.assertRaises(ValidationError):
self.env["res.partner"].create(
Expand Down Expand Up @@ -90,8 +97,6 @@ def test_fiscal_code_check_change_to_person(self):
}
)
partner.fiscalcode = wrong_person_fiscalcode
# pre-condition
self.assertFalse(isvalid(partner.fiscalcode))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Come mai serve togliere questi assert?
Se è solo perché non si usa più isvalid, potresti modificarli per usare il nuovo is_valid, cosa ne pensi?


# Act
with self.assertRaises(ValidationError) as ve:
Expand All @@ -117,8 +122,6 @@ def test_fiscal_code_check_company_VAT_change_to_person(self):
}
)
partner.fiscalcode = company_vat
# pre-condition
self.assertFalse(isvalid(partner.fiscalcode))

# Act
with self.assertRaises(ValidationError) as ve:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ elementpath
num2words>=0.5.12
openupgradelib
phonenumbers
python-stdnum
unidecode
xlrd
xlsxwriter
Expand Down