Skip to content

Commit f88eca2

Browse files
committed
[ADD] l10n_it_edi_oss: aggiunta PR OCA#5023
1 parent 3d16ffe commit f88eca2

20 files changed

Lines changed: 1032 additions & 0 deletions

l10n_it_edi_oss/README.rst

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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:7726bc879478d9950cf5864854b51db64c583ce368ca9b079e992e5e5e330fe9
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+
**Italiano**
32+
33+
Modulo tecnico di integrazione tra l10n_eu_oss_oca e l10n_it_edi
34+
35+
**English**
36+
37+
Technical module for integrating l10n_eu_oss_oca and l10n_it_edi
38+
39+
**Table of contents**
40+
41+
.. contents::
42+
:local:
43+
44+
Bug Tracker
45+
===========
46+
47+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
48+
In case of trouble, please check there if your issue has already been reported.
49+
If you spotted it first, help us to smash it by providing a detailed and welcomed
50+
`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**>`_.
51+
52+
Do not contact contributors directly about support or help with technical issues.
53+
54+
Credits
55+
=======
56+
57+
Authors
58+
-------
59+
60+
* Giuseppe Borruso
61+
62+
Contributors
63+
------------
64+
65+
- Giuseppe Borruso - Dinamiche Aziendali srl
66+
<gborruso@dinamicheaziendali.it>
67+
- Andrea Barbato - Dinamiche Aziendali srl
68+
<abarbato@dinamicheaziendali.it>
69+
70+
Maintainers
71+
-----------
72+
73+
This module is maintained by the OCA.
74+
75+
.. image:: https://odoo-community.org/logo.png
76+
:alt: Odoo Community Association
77+
:target: https://odoo-community.org
78+
79+
OCA, or the Odoo Community Association, is a nonprofit organization whose
80+
mission is to support the collaborative development of Odoo features and
81+
promote its widespread use.
82+
83+
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.
84+
85+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

l10n_it_edi_oss/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import models
2+
from . import wizard
3+
from .hooks import pre_absorb_old_module

l10n_it_edi_oss/__manifest__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2025 Giuseppe Borruso - Dinamiche Aziendali srl
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Italy - E-invoicing - Oss",
5+
"version": "18.0.1.0.0",
6+
"category": "Accounting/Localizations/EDI",
7+
"summary": "OSS support for Italian e-invoicing",
8+
"author": "Giuseppe Borruso, Odoo Community Association (OCA)",
9+
"website": "https://github.com/OCA/l10n-italy",
10+
"license": "AGPL-3",
11+
"external_dependencies": {
12+
"python": ["openupgradelib"],
13+
},
14+
"depends": [
15+
"l10n_eu_oss_oca",
16+
"l10n_it_edi",
17+
],
18+
"data": [
19+
"data/invoice_it_template.xml",
20+
],
21+
"installable": True,
22+
"pre_init_hook": "pre_absorb_old_module",
23+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
<template
4+
id="account_invoice_it_FatturaPA_export_oss_inherit"
5+
inherit_id="l10n_it_edi.account_invoice_it_FatturaPA_export"
6+
>
7+
<xpath
8+
expr="//DatiBeniServizi/t[@t-as='tax_line']/DatiRiepilogo"
9+
position="attributes"
10+
>
11+
<attribute name="t-if">
12+
not (tax_line.get('oss_country_id', False) and tax_line.get('natura', False))
13+
</attribute>
14+
</xpath>
15+
<xpath
16+
expr="//DatiBeniServizi/t[@t-as='tax_line']/DatiRiepilogo"
17+
position="after"
18+
>
19+
<DatiRiepilogo
20+
t-if="tax_line.get('oss_country_id', False) and tax_line.get('natura', False)"
21+
>
22+
<AliquotaIVA>0.00</AliquotaIVA>
23+
<Natura
24+
t-if="tax_line.get('natura', False)"
25+
t-out="tax_line['natura']"
26+
/>
27+
<Arrotondamento
28+
t-if="tax_line.get('arrotondamento', False)"
29+
t-out="format_float(tax_line['arrotondamento'], 8)"
30+
/>
31+
<ImponibileImporto
32+
t-out="format_float(tax_line['imponibile_importo'], 2)"
33+
/>
34+
<Imposta>0.00</Imposta>
35+
<EsigibilitaIVA
36+
t-if="tax_line.get('esigibilita_iva', False)"
37+
t-out="tax_line['esigibilita_iva']"
38+
/>
39+
<RiferimentoNormativo
40+
t-if="tax_line.get('riferimento_normativo', False)"
41+
t-out="format_alphanumeric(tax_line['riferimento_normativo'][:100])"
42+
/>
43+
</DatiRiepilogo>
44+
</xpath>
45+
</template>
46+
47+
<template
48+
id="account_invoice_line_it_FatturaPA_oss_inherit"
49+
inherit_id="l10n_it_edi.account_invoice_line_it_FatturaPA"
50+
>
51+
<xpath expr="//DettaglioLinee/AliquotaIVA" position="attributes">
52+
<attribute name="t-out">
53+
format_float(0, 2) if it_values.get('oss_country_id', False) and it_values.get('natura', False) else format_float(aliquota_iva, 2)
54+
</attribute>
55+
</xpath>
56+
</template>
57+
</odoo>

l10n_it_edi_oss/hooks.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
3+
from openupgradelib import openupgrade
4+
5+
6+
def pre_absorb_old_module(env):
7+
if openupgrade.is_module_installed(env.cr, "l10n_it_fatturapa_out_oss"):
8+
openupgrade.update_module_names(
9+
env.cr,
10+
[
11+
(
12+
"l10n_it_fatturapa_out_oss",
13+
"l10n_it_edi_oss",
14+
),
15+
],
16+
merge_modules=True,
17+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2025 Giuseppe Borruso - Dinamiche Aziendali srl
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
from odoo.addons.l10n_it_edi_oss import hooks
7+
8+
9+
@openupgrade.migrate()
10+
def migrate(env, version):
11+
# Used by OpenUpgrade when module is in `apriori`
12+
hooks.pre_absorb_old_module(env)

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: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright 2025 Giuseppe Borruso - Dinamiche Aziendali srl
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import api, models
5+
from odoo.tools import float_is_zero
6+
7+
8+
class AccountMoveInherit(models.Model):
9+
_inherit = "account.move"
10+
11+
# -------------------------------------------------------------------------
12+
# Helpers
13+
# -------------------------------------------------------------------------
14+
15+
def _l10n_it_edi_add_base_lines_xml_values(
16+
self, base_lines_aggregated_values, is_downpayment
17+
):
18+
res = super()._l10n_it_edi_add_base_lines_xml_values(
19+
base_lines_aggregated_values, is_downpayment
20+
)
21+
for base_line, _aggregated_values in base_lines_aggregated_values:
22+
vat_tax = (
23+
base_line["tax_ids"]
24+
.flatten_taxes_hierarchy()
25+
.filtered(lambda t: t._l10n_it_filter_kind("vat") and t.amount >= 0)[:1]
26+
)
27+
28+
if vat_tax.oss_country_id:
29+
base_line["it_values"]["oss_country_id"] = vat_tax.oss_country_id
30+
31+
vat_tax_amount = "%.*f" % (
32+
2,
33+
vat_tax.amount
34+
if not float_is_zero(vat_tax.amount, precision_digits=2)
35+
else 0.0,
36+
)
37+
base_line["it_values"]["altri_dati_gestionali_list"].extend(
38+
[
39+
{
40+
"tipo_dato": "OSS",
41+
"riferimento_testo": vat_tax_amount,
42+
"riferimento_numero": None,
43+
"riferimento_data": None,
44+
},
45+
]
46+
)
47+
return res
48+
49+
def _l10n_it_edi_get_tax_lines_xml_values(
50+
self, base_lines_aggregated_values, values_per_grouping_key
51+
):
52+
tax_lines = super()._l10n_it_edi_get_tax_lines_xml_values(
53+
base_lines_aggregated_values, values_per_grouping_key
54+
)
55+
56+
for tax_line, values in zip(
57+
tax_lines, values_per_grouping_key.values(), strict=True
58+
):
59+
grouping_key = values["grouping_key"]
60+
if not grouping_key or grouping_key["skip"]:
61+
continue
62+
63+
tax_line["oss_country_id"] = grouping_key.get("oss_country_id", None)
64+
65+
return tax_lines
66+
67+
@api.model
68+
def _l10n_it_edi_grouping_function_tax_lines(self, base_line, tax_data):
69+
res = super()._l10n_it_edi_grouping_function_tax_lines(base_line, tax_data)
70+
if not tax_data:
71+
return None
72+
tax = tax_data["tax"]
73+
74+
res["oss_country_id"] = tax.oss_country_id or None
75+
76+
return res

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Giuseppe Borruso - Dinamiche Aziendali srl \<<gborruso@dinamicheaziendali.it>\>
2+
- Andrea Barbato - Dinamiche Aziendali srl \<<abarbato@dinamicheaziendali.it>\>

0 commit comments

Comments
 (0)