Skip to content

Commit 41ff48f

Browse files
committed
[ADD]l10n_it_edi_sender_partner: module for managing TerzoIntermediario
1 parent 22f3cdb commit 41ff48f

18 files changed

+942
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
================================================
2+
Terzo intermediario per fatturazione elettronica
3+
================================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:1ee52872dd90b594fd4fa1d9c761b1625df8eb82b315a94b016d570f5c5eed71
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_sender_partner
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_sender_partner
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+
**English**
32+
33+
Module for managing the Third Party or Issuing Entity in electronic
34+
invoices. A dedicated field is available in the company record. When
35+
sending, if filled in, the intermediary is included in the XML. When
36+
importing, if the file contains an intermediary, it is linked to the
37+
invoice.
38+
39+
**Italiano**
40+
41+
Modulo per la gestione del Terzo Intermediario o Soggetto Emittente
42+
nelle fatture elettroniche. Il campo dedicato è disponibile
43+
nell’anagrafica azienda. In fase di invio, se valorizzato,
44+
l’intermediario viene riportato nell’XML. In fase di importazione, se il
45+
file contiene un intermediario, questo viene collegato alla fattura.
46+
47+
**Table of contents**
48+
49+
.. contents::
50+
:local:
51+
52+
Bug Tracker
53+
===========
54+
55+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
56+
In case of trouble, please check there if your issue has already been reported.
57+
If you spotted it first, help us to smash it by providing a detailed and welcomed
58+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_edi_sender_partner%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
59+
60+
Do not contact contributors directly about support or help with technical issues.
61+
62+
Credits
63+
=======
64+
65+
Authors
66+
-------
67+
68+
* Nextev Srl
69+
70+
Contributors
71+
------------
72+
73+
- Nextev Srl <https://www.nextev.it>
74+
75+
Maintainers
76+
-----------
77+
78+
This module is maintained by the OCA.
79+
80+
.. image:: https://odoo-community.org/logo.png
81+
:alt: Odoo Community Association
82+
:target: https://odoo-community.org
83+
84+
OCA, or the Odoo Community Association, is a nonprofit organization whose
85+
mission is to support the collaborative development of Odoo features and
86+
promote its widespread use.
87+
88+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_edi_sender_partner>`_ project on GitHub.
89+
90+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
2+
3+
from . import models
4+
5+
from odoo.tools import config
6+
7+
from openupgradelib import openupgrade, openupgrade_tools
8+
9+
from odoo.addons.base.models.ir_qweb_fields import Markup, nl2br, nl2br_enclose
10+
11+
12+
def _l10n_it_fatturapa_pre_migration(env):
13+
RENAMED_FIELDS = [
14+
[
15+
(
16+
"res.company",
17+
"fatturapa_sender_partner",
18+
),
19+
(
20+
"res.company",
21+
"l10n_edi_it_sender_partner",
22+
),
23+
],
24+
[
25+
(
26+
"account.move",
27+
"intermediary",
28+
),
29+
(
30+
"account.move",
31+
"l10n_it_edi_intermediary_id",
32+
),
33+
],
34+
]
35+
field_spec = []
36+
for renamed_field in RENAMED_FIELDS:
37+
(old_model, old_field), (new_model, new_field) = renamed_field
38+
field_spec.append(
39+
(
40+
old_model,
41+
new_model.replace(".", "_"),
42+
old_field,
43+
new_field,
44+
)
45+
)
46+
openupgrade.rename_fields(
47+
env,
48+
field_spec,
49+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
2+
3+
{
4+
"name": "Terzo intermediario per fatturazione elettronica",
5+
"version": "18.0.1.0.0",
6+
"category": "Localization/Italy",
7+
"summary": "Terzo intermediario o soggetto emittete per fatturazione elettronica",
8+
"author": "Nextev Srl, Odoo Community Association (OCA)",
9+
"website": "https://github.com/OCA/l10n-italy",
10+
"license": "AGPL-3",
11+
"depends": [
12+
"l10n_it_edi_extension",
13+
],
14+
"data": [
15+
"views/l10n_it_sender_partner.xml",
16+
"views/l10n_it_view.xml",
17+
"views/account_view.xml",
18+
"data/invoice_it_template.xml",
19+
],
20+
"installable": True,
21+
"pre_init_hook": "_l10n_it_fatturapa_pre_migration",
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
<template
4+
id="account_invoice_it_partner_sender"
5+
inherit_id="l10n_it_edi.account_invoice_it_FatturaPA_export"
6+
>
7+
<xpath expr="//CessionarioCommittente" position="after">
8+
<t
9+
t-call="l10n_it_edi_sender_partner.l10n_it_edi_terzo_intermediario_soggetto_emittente"
10+
/>
11+
<SoggettoEmittente
12+
t-if="company.l10n_edi_it_sender_partner"
13+
>TZ</SoggettoEmittente>
14+
</xpath>
15+
</template>
16+
</odoo>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
2+
3+
from . import account_move
4+
from . import res_company
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
2+
3+
from odoo import fields, models
4+
5+
from odoo.addons.l10n_it_edi.models.account_move import get_text
6+
7+
8+
class AccountMove(models.Model):
9+
_inherit = "account.move"
10+
11+
l10n_it_edi_intermediary_id = fields.Many2one("res.partner", string="Intermediary")
12+
13+
def _l10n_it_edi_import_invoice(self, invoice, data, is_new):
14+
res = super()._l10n_it_edi_import_invoice(invoice, data, is_new)
15+
Partner = self.env["res.partner"]
16+
tree = data["xml_tree"]
17+
intermediary = tree.xpath("//TerzoIntermediarioOSoggettoEmittente")[0]
18+
if not intermediary:
19+
return res
20+
vat = get_text(intermediary, ".//IdCodice")
21+
if not vat:
22+
return res
23+
intermediary_id = Partner.search([("vat", "ilike", vat)], limit=1)
24+
if intermediary_id:
25+
invoice.l10n_it_edi_intermediary_id = intermediary_id
26+
return res
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
2+
3+
from odoo import fields, models
4+
5+
6+
class ResCompany(models.Model):
7+
_inherit = "res.company"
8+
9+
l10n_edi_it_sender_partner = fields.Many2one(
10+
"res.partner",
11+
string="Third Party/Sender",
12+
help="Data of Third-Party Issuer Intermediary who emits the "
13+
"invoice on behalf of the seller/provider",
14+
)
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+
- Nextev Srl \<<https://www.nextev.it>\>
2+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
**English**
2+
3+
Module for managing the Third Party or Issuing Entity
4+
in electronic invoices.
5+
A dedicated field is available in the company record.
6+
When sending, if filled in, the intermediary is included
7+
in the XML.
8+
When importing, if the file contains an intermediary,
9+
it is linked to the invoice.
10+
11+
**Italiano**
12+
13+
Modulo per la gestione del Terzo Intermediario o Soggetto
14+
Emittente nelle fatture elettroniche.
15+
Il campo dedicato è disponibile nell’anagrafica azienda.
16+
In fase di invio, se valorizzato, l’intermediario viene riportato
17+
nell’XML.
18+
In fase di importazione, se il file contiene un intermediario,
19+
questo viene collegato alla fattura.

0 commit comments

Comments
 (0)