Skip to content

Commit 1a22110

Browse files
committed
l10n_it_edi_oss
1 parent 77e3b95 commit 1a22110

File tree

14 files changed

+888
-0
lines changed

14 files changed

+888
-0
lines changed

l10n_it_edi_oss/README.rst

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
=========================
2+
Italy - E-invoicing - OSS
3+
=========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:1e9d2501f6aacc03319d6346c6de801fcfdcbb7a049c66d039aca3bb86e09eec
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
20+
:target: https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_edi_oss
21+
:alt: OCA/l10n-italy
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/l10n-italy-18-0/l10n-italy-18-0-l10n_it_edi_oss
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Modulo tecnico per l'integrazione tra ``l10n_eu_oss_oca`` (regime OSS -
32+
One Stop Shop) e ``l10n_it_edi`` (fatturazione elettronica italiana).
33+
34+
Quando viene emessa una fattura con un'imposta OSS, il modulo modifica
35+
la generazione del file XML FatturaPA per:
36+
37+
- Impostare AliquotaIVA a 0,00 (invece dell'aliquota estera effettiva)
38+
- Aggiungere il codice Natura N3.2 (non imponibile - cessioni
39+
intracomunitarie)
40+
- Aggiungere un blocco AltriDatiGestionali con TipoDato "OSS" e
41+
l'aliquota effettiva
42+
- Impostare Imposta a 0,00 nel riepilogo DatiRiepilogo
43+
- Aggiungere il RiferimentoNormativo con il riferimento all'Art. 41
44+
D.L. 331/1993
45+
46+
Inoltre, quando vengono create nuove imposte OSS tramite il wizard di
47+
``l10n_eu_oss_oca``, il modulo imposta automaticamente il codice Natura
48+
e il riferimento normativo.
49+
50+
--------------
51+
52+
Technical module integrating ``l10n_eu_oss_oca`` (OSS - One Stop Shop
53+
regime) with ``l10n_it_edi`` (Italian electronic invoicing).
54+
55+
When an invoice is issued with an OSS tax, this module modifies the
56+
FatturaPA XML generation to:
57+
58+
- Set AliquotaIVA to 0.00 (instead of the actual foreign tax rate)
59+
- Add the Natura code N3.2 (non-taxable - intra-community transfers)
60+
- Add an AltriDatiGestionali block with TipoDato "OSS" and the actual
61+
tax rate
62+
- Set Imposta to 0.00 in the DatiRiepilogo summary
63+
- Add the RiferimentoNormativo with the reference to Art. 41 D.L.
64+
331/1993
65+
66+
Additionally, when new OSS taxes are created through the
67+
``l10n_eu_oss_oca`` wizard, the module automatically sets the Natura
68+
code and law reference.
69+
70+
**Table of contents**
71+
72+
.. contents::
73+
:local:
74+
75+
Bug Tracker
76+
===========
77+
78+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
79+
In case of trouble, please check there if your issue has already been reported.
80+
If you spotted it first, help us to smash it by providing a detailed and welcomed
81+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_edi_oss%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
82+
83+
Do not contact contributors directly about support or help with technical issues.
84+
85+
Credits
86+
=======
87+
88+
Authors
89+
-------
90+
91+
* Lorenzo Battistini
92+
93+
Contributors
94+
------------
95+
96+
- Lorenzo Battistini
97+
98+
Maintainers
99+
-----------
100+
101+
This module is maintained by the OCA.
102+
103+
.. image:: https://odoo-community.org/logo.png
104+
:alt: Odoo Community Association
105+
:target: https://odoo-community.org
106+
107+
OCA, or the Odoo Community Association, is a nonprofit organization whose
108+
mission is to support the collaborative development of Odoo features and
109+
promote its widespread use.
110+
111+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_edi_oss>`_ project on GitHub.
112+
113+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

l10n_it_edi_oss/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from . import models
2+
from . import wizard
3+
4+
OSS_EXEMPT_REASON = "N3.2"
5+
OSS_LAW_REFERENCE = "Art. 41 D.L. 331/1993"
6+
7+
8+
def _l10n_it_edi_oss_post_init_hook(env):
9+
oss_taxes = env["account.tax"].search(
10+
[
11+
("oss_country_id", "!=", False),
12+
("company_id.account_fiscal_country_id.code", "=", "IT"),
13+
"|",
14+
("l10n_it_exempt_reason", "=", False),
15+
("l10n_it_exempt_reason", "!=", OSS_EXEMPT_REASON),
16+
]
17+
)
18+
if oss_taxes:
19+
oss_taxes.write(
20+
{
21+
"l10n_it_exempt_reason": OSS_EXEMPT_REASON,
22+
"l10n_it_law_reference": OSS_LAW_REFERENCE,
23+
}
24+
)

l10n_it_edi_oss/__manifest__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2026 Lorenzo Battistini
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
{
5+
"name": "Italy - E-invoicing - OSS",
6+
"version": "18.0.1.0.0",
7+
"category": "Accounting/Localizations/EDI",
8+
"development_status": "Beta",
9+
"summary": "Bridge module between l10n_eu_oss_oca and Italian electronic invoicing",
10+
"author": "Lorenzo Battistini, Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/l10n-italy",
12+
"license": "AGPL-3",
13+
"depends": [
14+
"l10n_it_edi",
15+
"l10n_eu_oss_oca",
16+
],
17+
"installable": True,
18+
"post_init_hook": "_l10n_it_edi_oss_post_init_hook",
19+
}

l10n_it_edi_oss/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import account_move
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright 2026 Lorenzo Battistini
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import api, models
5+
6+
7+
class AccountMove(models.Model):
8+
_inherit = "account.move"
9+
10+
@api.model
11+
def _l10n_it_edi_grouping_function_base_lines(self, base_line, tax_data):
12+
result = super()._l10n_it_edi_grouping_function_base_lines(base_line, tax_data)
13+
if result and tax_data and tax_data["tax"].oss_country_id:
14+
result["tax_amount_field"] = 0.0
15+
return result
16+
17+
@api.model
18+
def _l10n_it_edi_grouping_function_tax_lines(self, base_line, tax_data):
19+
result = super()._l10n_it_edi_grouping_function_tax_lines(base_line, tax_data)
20+
if result and tax_data and tax_data["tax"].oss_country_id:
21+
result["tax_amount_field"] = 0.0
22+
result["is_oss"] = True
23+
return result
24+
25+
def _l10n_it_edi_add_base_lines_xml_values(
26+
self, base_lines_aggregated_values, is_downpayment
27+
):
28+
super()._l10n_it_edi_add_base_lines_xml_values(
29+
base_lines_aggregated_values, is_downpayment
30+
)
31+
for base_line, _aggregated_values in base_lines_aggregated_values:
32+
oss_taxes = base_line["tax_ids"].filtered(lambda t: t.oss_country_id)
33+
if oss_taxes:
34+
base_line["it_values"]["altri_dati_gestionali_list"].append(
35+
{
36+
"tipo_dato": "OSS",
37+
"riferimento_testo": f"{oss_taxes[0].amount:.2f}",
38+
"riferimento_numero": None,
39+
"riferimento_data": None,
40+
}
41+
)
42+
43+
def _l10n_it_edi_get_tax_lines_xml_values(
44+
self, base_lines_aggregated_values, values_per_grouping_key
45+
):
46+
tax_lines = super()._l10n_it_edi_get_tax_lines_xml_values(
47+
base_lines_aggregated_values, values_per_grouping_key
48+
)
49+
# Set imposta to 0.0 for OSS entries.
50+
# Iterate values_per_grouping_key in the same order as super() to
51+
# correlate grouping keys with the returned tax_lines by index.
52+
idx = 0
53+
for values in values_per_grouping_key.values():
54+
grouping_key = values["grouping_key"]
55+
if not grouping_key or grouping_key.get("skip"):
56+
continue
57+
if grouping_key.get("is_oss") and idx < len(tax_lines):
58+
tax_lines[idx]["imposta"] = 0.0
59+
idx += 1
60+
return tax_lines

l10n_it_edi_oss/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Lorenzo Battistini
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Modulo tecnico per l'integrazione tra `l10n_eu_oss_oca` (regime OSS - One Stop Shop)
2+
e `l10n_it_edi` (fatturazione elettronica italiana).
3+
4+
Quando viene emessa una fattura con un'imposta OSS, il modulo modifica la generazione
5+
del file XML FatturaPA per:
6+
7+
- Impostare AliquotaIVA a 0,00 (invece dell'aliquota estera effettiva)
8+
- Aggiungere il codice Natura N3.2 (non imponibile - cessioni intracomunitarie)
9+
- Aggiungere un blocco AltriDatiGestionali con TipoDato "OSS" e l'aliquota effettiva
10+
- Impostare Imposta a 0,00 nel riepilogo DatiRiepilogo
11+
- Aggiungere il RiferimentoNormativo con il riferimento all'Art. 41 D.L. 331/1993
12+
13+
Inoltre, quando vengono create nuove imposte OSS tramite il wizard di `l10n_eu_oss_oca`,
14+
il modulo imposta automaticamente il codice Natura e il riferimento normativo.
15+
16+
---
17+
18+
Technical module integrating `l10n_eu_oss_oca` (OSS - One Stop Shop regime) with
19+
`l10n_it_edi` (Italian electronic invoicing).
20+
21+
When an invoice is issued with an OSS tax, this module modifies the FatturaPA XML
22+
generation to:
23+
24+
- Set AliquotaIVA to 0.00 (instead of the actual foreign tax rate)
25+
- Add the Natura code N3.2 (non-taxable - intra-community transfers)
26+
- Add an AltriDatiGestionali block with TipoDato "OSS" and the actual tax rate
27+
- Set Imposta to 0.00 in the DatiRiepilogo summary
28+
- Add the RiferimentoNormativo with the reference to Art. 41 D.L. 331/1993
29+
30+
Additionally, when new OSS taxes are created through the `l10n_eu_oss_oca` wizard,
31+
the module automatically sets the Natura code and law reference.

0 commit comments

Comments
 (0)