odoo-addon-l10n-it-edi-related-document 18.0.1.0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. odoo/addons/l10n_it_edi_related_document/README.rst +95 -0
  2. odoo/addons/l10n_it_edi_related_document/__init__.py +26 -0
  3. odoo/addons/l10n_it_edi_related_document/__manifest__.py +21 -0
  4. odoo/addons/l10n_it_edi_related_document/data/invoice_it_template.xml +13 -0
  5. odoo/addons/l10n_it_edi_related_document/i18n/l10n_it_edi_related_document.pot +148 -0
  6. odoo/addons/l10n_it_edi_related_document/models/__init__.py +4 -0
  7. odoo/addons/l10n_it_edi_related_document/models/account_move.py +134 -0
  8. odoo/addons/l10n_it_edi_related_document/models/account_move_line.py +12 -0
  9. odoo/addons/l10n_it_edi_related_document/readme/CONTRIBUTORS.md +1 -0
  10. odoo/addons/l10n_it_edi_related_document/readme/DESCRIPTION.md +19 -0
  11. odoo/addons/l10n_it_edi_related_document/security/ir.model.access.csv +2 -0
  12. odoo/addons/l10n_it_edi_related_document/static/description/icon.png +0 -0
  13. odoo/addons/l10n_it_edi_related_document/static/description/index.html +441 -0
  14. odoo/addons/l10n_it_edi_related_document/tests/__init__.py +1 -0
  15. odoo/addons/l10n_it_edi_related_document/tests/import_xmls/IT01234567888_FPR01_02.xml +143 -0
  16. odoo/addons/l10n_it_edi_related_document/tests/test_import_xml.py +33 -0
  17. odoo/addons/l10n_it_edi_related_document/views/account_move_related_documents.xml +64 -0
  18. odoo/addons/l10n_it_edi_related_document/views/l10n_it_views.xml +37 -0
  19. odoo/addons/l10n_it_edi_related_document/views/related_document_views.xml +60 -0
  20. odoo_addon_l10n_it_edi_related_document-18.0.1.0.0.3.dist-info/METADATA +111 -0
  21. odoo_addon_l10n_it_edi_related_document-18.0.1.0.0.3.dist-info/RECORD +23 -0
  22. odoo_addon_l10n_it_edi_related_document-18.0.1.0.0.3.dist-info/WHEEL +5 -0
  23. odoo_addon_l10n_it_edi_related_document-18.0.1.0.0.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,95 @@
1
+ .. image:: https://odoo-community.org/readme-banner-image
2
+ :target: https://odoo-community.org/get-involved?utm_source=readme
3
+ :alt: Odoo Community Association
4
+
5
+ =========================
6
+ Related Documents for EDI
7
+ =========================
8
+
9
+ ..
10
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11
+ !! This file is generated by oca-gen-addon-readme !!
12
+ !! changes will be overwritten. !!
13
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
+ !! source digest: sha256:9635cb722bff9cdf86aa4c791204157e4ab84e3440f753772ca8a8484b2f5ba8
15
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16
+
17
+ .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18
+ :target: https://odoo-community.org/page/development-status
19
+ :alt: Beta
20
+ .. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22
+ :alt: License: AGPL-3
23
+ .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
24
+ :target: https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_edi_related_document
25
+ :alt: OCA/l10n-italy
26
+ .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27
+ :target: https://translation.odoo-community.org/projects/l10n-italy-18-0/l10n-italy-18-0-l10n_it_edi_related_document
28
+ :alt: Translate me on Weblate
29
+ .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=18.0
31
+ :alt: Try me on Runboat
32
+
33
+ |badge1| |badge2| |badge3| |badge4| |badge5|
34
+
35
+ **English**
36
+
37
+ Module for managing the types of documents linked to invoices. The data
38
+ related to the linked documents is then exported in the electronic
39
+ invoice XML or imported during the creation of an invoice from an XML
40
+ file. If a related document has 0 as the line reference, it means that
41
+ it refers to the entire document and not to a specific invoice line.
42
+
43
+ **Italiano**
44
+
45
+ Modulo per la gestione dei tipi di documenti collegati alle fatture. I
46
+ dati relativi ai documenti collegati vengono poi esportati nell'XML
47
+ della fattura elettronica oppure importati durante la creazione di una
48
+ fattura da XML. Nel caso in cui un documento collegato abbia 0 come
49
+ riferimento linea, significa che è riferito all’intero documento e non
50
+ ad una specifica linea della fattura.
51
+
52
+ **Table of contents**
53
+
54
+ .. contents::
55
+ :local:
56
+
57
+ Bug Tracker
58
+ ===========
59
+
60
+ Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
61
+ In case of trouble, please check there if your issue has already been reported.
62
+ If you spotted it first, help us to smash it by providing a detailed and welcomed
63
+ `feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_edi_related_document%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
64
+
65
+ Do not contact contributors directly about support or help with technical issues.
66
+
67
+ Credits
68
+ =======
69
+
70
+ Authors
71
+ -------
72
+
73
+ * Nextev Srl
74
+
75
+ Contributors
76
+ ------------
77
+
78
+ - Nextev Srl <odoo@nextev.it>
79
+
80
+ Maintainers
81
+ -----------
82
+
83
+ This module is maintained by the OCA.
84
+
85
+ .. image:: https://odoo-community.org/logo.png
86
+ :alt: Odoo Community Association
87
+ :target: https://odoo-community.org
88
+
89
+ OCA, or the Odoo Community Association, is a nonprofit organization whose
90
+ mission is to support the collaborative development of Odoo features and
91
+ promote its widespread use.
92
+
93
+ This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_edi_related_document>`_ project on GitHub.
94
+
95
+ You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
@@ -0,0 +1,26 @@
1
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2
+
3
+ from . import models
4
+ from openupgradelib import openupgrade
5
+
6
+
7
+ def _insert_account_move_related_document(env):
8
+ cr = env.cr
9
+ cr.execute("SELECT * FROM fatturapa_related_document_type LIMIT 1")
10
+ if cr.fetchone():
11
+ cr.execute("""
12
+ INSERT INTO account_move_related_document (
13
+ type, name, "lineRef", invoice_id, invoice_line_id, date,
14
+ numitem, code, cig, cup
15
+ )
16
+ SELECT
17
+ type, name, "lineRef", invoice_id, invoice_line_id, date,
18
+ numitem, code, cig, cup
19
+ FROM fatturapa_related_document_type
20
+ """)
21
+
22
+
23
+ def _l10n_it_edi_related_document_post_init_hook(env):
24
+ module = "l10n_it_fatturapa"
25
+ if openupgrade.is_module_installed(env.cr, module):
26
+ _insert_account_move_related_document(env)
@@ -0,0 +1,21 @@
1
+ # Copyright 2025 Nextev Srl
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+
4
+ {
5
+ "name": "Related Documents for EDI",
6
+ "version": "18.0.1.0.0",
7
+ "category": "Localization/Italy",
8
+ "author": "Nextev Srl, Odoo Community Association (OCA)",
9
+ "website": "https://github.com/OCA/l10n-italy",
10
+ "license": "AGPL-3",
11
+ "depends": ["l10n_it_edi"],
12
+ "data": [
13
+ "views/related_document_views.xml",
14
+ "views/l10n_it_views.xml",
15
+ "views/account_move_related_documents.xml",
16
+ "data/invoice_it_template.xml",
17
+ "security/ir.model.access.csv",
18
+ ],
19
+ "installable": True,
20
+ "post_init_hook": "_l10n_it_edi_related_document_post_init_hook",
21
+ }
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <odoo>
3
+ <template
4
+ id="account_invoice_it_FatturaPA_export_inherit"
5
+ inherit_id="l10n_it_edi.account_invoice_it_FatturaPA_export"
6
+ >
7
+ <xpath expr="//DatiGeneraliDocumento" position="after">
8
+ <t
9
+ t-call="l10n_it_edi_related_document.account_invoice_it_dati_documenti_correlati"
10
+ />
11
+ </xpath>
12
+ </template>
13
+ </odoo>
@@ -0,0 +1,148 @@
1
+ # Translation of Odoo Server.
2
+ # This file contains the translation of the following modules:
3
+ # * l10n_it_edi_related_document
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: Odoo Server 18.0\n"
8
+ "Report-Msgid-Bugs-To: \n"
9
+ "Last-Translator: \n"
10
+ "Language-Team: \n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: \n"
14
+ "Plural-Forms: \n"
15
+
16
+ #. module: l10n_it_edi_related_document
17
+ #: model:ir.model.fields.selection,name:l10n_it_edi_related_document.selection__account_move_related_document__type__agreement
18
+ msgid "Agreement"
19
+ msgstr ""
20
+
21
+ #. module: l10n_it_edi_related_document
22
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__cig
23
+ msgid "CIG Code"
24
+ msgstr ""
25
+
26
+ #. module: l10n_it_edi_related_document
27
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__cup
28
+ msgid "CUP Code"
29
+ msgstr ""
30
+
31
+ #. module: l10n_it_edi_related_document
32
+ #: model:ir.model.fields.selection,name:l10n_it_edi_related_document.selection__account_move_related_document__type__contract
33
+ msgid "Contract"
34
+ msgstr ""
35
+
36
+ #. module: l10n_it_edi_related_document
37
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__create_uid
38
+ msgid "Created by"
39
+ msgstr ""
40
+
41
+ #. module: l10n_it_edi_related_document
42
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__create_date
43
+ msgid "Created on"
44
+ msgstr ""
45
+
46
+ #. module: l10n_it_edi_related_document
47
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__date
48
+ msgid "Date"
49
+ msgstr ""
50
+
51
+ #. module: l10n_it_edi_related_document
52
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__display_name
53
+ msgid "Display Name"
54
+ msgstr ""
55
+
56
+ #. module: l10n_it_edi_related_document
57
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__type
58
+ msgid "Document"
59
+ msgstr ""
60
+
61
+ #. module: l10n_it_edi_related_document
62
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__name
63
+ msgid "Document ID"
64
+ msgstr ""
65
+
66
+ #. module: l10n_it_edi_related_document
67
+ #: model:ir.model,name:l10n_it_edi_related_document.model_account_move_related_document
68
+ msgid "E-invoice Related Documents"
69
+ msgstr ""
70
+
71
+ #. module: l10n_it_edi_related_document
72
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__id
73
+ msgid "ID"
74
+ msgstr ""
75
+
76
+ #. module: l10n_it_edi_related_document
77
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__numitem
78
+ msgid "Item Num."
79
+ msgstr ""
80
+
81
+ #. module: l10n_it_edi_related_document
82
+ #: model:ir.model,name:l10n_it_edi_related_document.model_account_move
83
+ msgid "Journal Entry"
84
+ msgstr ""
85
+
86
+ #. module: l10n_it_edi_related_document
87
+ #: model:ir.model,name:l10n_it_edi_related_document.model_account_move_line
88
+ msgid "Journal Item"
89
+ msgstr ""
90
+
91
+ #. module: l10n_it_edi_related_document
92
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__write_uid
93
+ msgid "Last Updated by"
94
+ msgstr ""
95
+
96
+ #. module: l10n_it_edi_related_document
97
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__write_date
98
+ msgid "Last Updated on"
99
+ msgstr ""
100
+
101
+ #. module: l10n_it_edi_related_document
102
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__lineRef
103
+ msgid "Line Ref."
104
+ msgstr ""
105
+
106
+ #. module: l10n_it_edi_related_document
107
+ #: model:ir.model.fields.selection,name:l10n_it_edi_related_document.selection__account_move_related_document__type__order
108
+ msgid "Order"
109
+ msgstr ""
110
+
111
+ #. module: l10n_it_edi_related_document
112
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__code
113
+ msgid "Order Agreement Code"
114
+ msgstr ""
115
+
116
+ #. module: l10n_it_edi_related_document
117
+ #: model:ir.model.fields.selection,name:l10n_it_edi_related_document.selection__account_move_related_document__type__reception
118
+ msgid "Reception"
119
+ msgstr ""
120
+
121
+ #. module: l10n_it_edi_related_document
122
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_bank_statement_line__related_document_ids
123
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move__related_document_ids
124
+ msgid "Related Document"
125
+ msgstr ""
126
+
127
+ #. module: l10n_it_edi_related_document
128
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_line__related_document_ids
129
+ #: model_terms:ir.ui.view,arch_db:l10n_it_edi_related_document.account_invoice_form_related_document
130
+ msgid "Related Documents"
131
+ msgstr ""
132
+
133
+ #. module: l10n_it_edi_related_document
134
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__invoice_id
135
+ #: model:ir.model.fields.selection,name:l10n_it_edi_related_document.selection__account_move_related_document__type__invoice
136
+ msgid "Related Invoice"
137
+ msgstr ""
138
+
139
+ #. module: l10n_it_edi_related_document
140
+ #: model:ir.model.fields,field_description:l10n_it_edi_related_document.field_account_move_related_document__invoice_line_id
141
+ msgid "Related Invoice Line"
142
+ msgstr ""
143
+
144
+ #. module: l10n_it_edi_related_document
145
+ #: model:ir.actions.act_window,name:l10n_it_edi_related_document.account_move_related_document_action
146
+ #: model:ir.ui.menu,name:l10n_it_edi_related_document.account_move_related_document_menu
147
+ msgid "Related documents"
148
+ msgstr ""
@@ -0,0 +1,4 @@
1
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2
+
3
+ from . import account_move
4
+ from . import account_move_line
@@ -0,0 +1,134 @@
1
+ from odoo import api, fields, models
2
+
3
+ from odoo.addons.l10n_it_edi.models.account_move import get_text
4
+
5
+
6
+ class AccountMoveRelatedDocumentType(models.Model):
7
+ _name = "account.move.related_document"
8
+ _description = "E-invoice Related Documents"
9
+
10
+ type = fields.Selection(
11
+ [
12
+ ("order", "Order"),
13
+ ("contract", "Contract"),
14
+ ("agreement", "Agreement"),
15
+ ("reception", "Reception"),
16
+ ("invoice", "Related Invoice"),
17
+ ],
18
+ "Document",
19
+ required=True,
20
+ )
21
+ name = fields.Char("Document ID", size=20, required=True)
22
+ lineRef = fields.Integer("Line Ref.")
23
+ invoice_id = fields.Many2one(
24
+ "account.move",
25
+ "Related Invoice",
26
+ ondelete="cascade",
27
+ index=True,
28
+ readonly=True,
29
+ )
30
+ date = fields.Date()
31
+ numitem = fields.Char("Item Num.", size=20)
32
+ code = fields.Char("Order Agreement Code", size=100)
33
+ cig = fields.Char("CIG Code", size=15)
34
+ cup = fields.Char("CUP Code", size=15)
35
+ invoice_line_id = fields.Many2one(
36
+ "account.move.line",
37
+ "Related Invoice Line",
38
+ ondelete="cascade",
39
+ index=True,
40
+ readonly=True,
41
+ )
42
+
43
+ @api.model_create_multi
44
+ def create(self, vals_list):
45
+ line_obj = self.env["account.move.line"]
46
+ for vals in vals_list:
47
+ if (
48
+ vals.get("lineRef")
49
+ and not vals.get("invoice_line_id")
50
+ and vals.get("invoice_id")
51
+ ):
52
+ line = line_obj.search(
53
+ [
54
+ ("move_id", "=", vals["invoice_id"]),
55
+ ("sequence", "=", vals["lineRef"]),
56
+ ],
57
+ limit=1,
58
+ )
59
+ if line:
60
+ vals["invoice_line_id"] = line.id
61
+ return super().create(vals_list)
62
+
63
+
64
+ class AccountMove(models.Model):
65
+ _inherit = "account.move"
66
+
67
+ related_document_ids = fields.One2many(
68
+ "account.move.related_document", "invoice_id", copy=False
69
+ )
70
+
71
+ def _l10n_it_edi_get_values(self, pdf_values=None):
72
+ res = super()._l10n_it_edi_get_values(pdf_values=pdf_values)
73
+ updated_values = self.remove_redundant_values(res)
74
+ return updated_values
75
+
76
+ def remove_redundant_values(self, values):
77
+ redundant_list = [
78
+ "cig",
79
+ "cup",
80
+ "origin_document_type",
81
+ "origin_document_name",
82
+ "origin_document_date",
83
+ ]
84
+ for key in redundant_list:
85
+ values.pop(key, None)
86
+ return values
87
+
88
+ def _l10n_it_edi_import_invoice(self, invoice, data, is_new):
89
+ res = super()._l10n_it_edi_import_invoice(invoice, data, is_new)
90
+ tree = data["xml_tree"]
91
+ rel_docs_dict = {
92
+ "order": tree.xpath(".//DatiOrdineAcquisto"),
93
+ "contract": tree.xpath(".//DatiContratto"),
94
+ "agreement": tree.xpath(".//DatiConvenzione"),
95
+ "reception": tree.xpath(".//DatiRicezione"),
96
+ "invoice": tree.xpath(".//DatiFattureCollegate"),
97
+ }
98
+ self.create_related_document(invoice, rel_docs_dict)
99
+ return res
100
+
101
+ def create_related_document(self, invoice, rel_docs_dict):
102
+ result = []
103
+ invoice_line_model = self.env["account.move.line"]
104
+ for key, rel_doc in rel_docs_dict.items():
105
+ for element in rel_doc:
106
+ invoice_lineid = False
107
+ lineRef = get_text(element, "./RiferimentoNumeroLinea")
108
+ if lineRef:
109
+ invoice_line = invoice_line_model.search(
110
+ [
111
+ ("move_id", "=", invoice.id),
112
+ ("sequence", "=", int(lineRef)),
113
+ ],
114
+ limit=1,
115
+ )
116
+ if invoice_line:
117
+ invoice_lineid = invoice_line.id
118
+ entry = {
119
+ "type": key,
120
+ "lineRef": lineRef,
121
+ "name": get_text(element, "./IdDocumento"),
122
+ "date": get_text(element, "./Data"),
123
+ "numitem": get_text(element, "./NumItem"),
124
+ "code": get_text(element, "./CodiceCommessaConvenzione"),
125
+ "cup": get_text(element, "./CodiceCUP"),
126
+ "cig": get_text(element, "./CodiceCIG"),
127
+ "invoice_id": invoice.id,
128
+ "invoice_line_id": invoice_lineid,
129
+ }
130
+ entry = {k: v for k, v in entry.items() if v}
131
+ result.append(entry)
132
+ model = self.env["account.move.related_document"]
133
+ model.create(result)
134
+ return result
@@ -0,0 +1,12 @@
1
+ from odoo import fields, models
2
+
3
+
4
+ class AccountMoveLine(models.Model):
5
+ _inherit = "account.move.line"
6
+
7
+ related_document_ids = fields.One2many(
8
+ "account.move.related_document",
9
+ "invoice_line_id",
10
+ "Related Documents",
11
+ copy=False,
12
+ )
@@ -0,0 +1 @@
1
+ - Nextev Srl \<<odoo@nextev.it>\>
@@ -0,0 +1,19 @@
1
+ **English**
2
+
3
+ Module for managing the types of documents linked to invoices.
4
+ The data related to the linked documents is then exported in
5
+ the electronic invoice XML or imported during the creation of
6
+ an invoice from an XML file.
7
+ If a related document has 0 as the line reference, it means that
8
+ it refers to the entire document and not to a specific
9
+ invoice line.
10
+
11
+ **Italiano**
12
+
13
+ Modulo per la gestione dei tipi di documenti collegati alle fatture.
14
+ I dati relativi ai documenti collegati vengono poi esportati nell'XML
15
+ della fattura elettronica oppure importati durante la creazione di una
16
+ fattura da XML.
17
+ Nel caso in cui un documento collegato abbia 0 come riferimento linea,
18
+ significa che è riferito all’intero documento e non ad una specifica
19
+ linea della fattura.
@@ -0,0 +1,2 @@
1
+ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2
+ l10n_it_edi_related_document.access_account_move_related_document,access_account_move_related_document,l10n_it_edi_related_document.model_account_move_related_document,account.group_account_invoice,1,1,1,1