Initial commit: L10N_Europe packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:52 +02:00
commit 9803722600
2377 changed files with 380711 additions and 0 deletions

View file

@ -0,0 +1,55 @@
# Italy - E-invoicing (PA)
Public Administration partners flow handling for the E-invoice implementation for Italy.
Several more fields are required for invoicing Public Administration businesses.
The Origin Document is to be exported in the XML when invoicing the Public Administration,
It can be a Contract, an Agreement, a Purchase Order, a Linked Invoice or a Down Payment,
it will need the CIG and CUP fields which are mandatory.
They both serve the purpose to trace public funds being invested on purchases.
CIG is the Tender Unique Identifier, CUP identifies the Public Project of Investment.
## Installation
```bash
pip install odoo-bringout-oca-ocb-l10n_it_edi_pa
```
## Dependencies
This addon depends on:
- l10n_it_edi
## Manifest Information
- **Name**: Italy - E-invoicing (PA)
- **Version**: 0.1
- **Category**: Accounting/Localizations/EDI
- **License**: LGPL-3
- **Installable**: False
## Source
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `l10n_it_edi_pa`.
## License
This package maintains the original LGPL-3 license from the upstream Odoo project.
## Documentation
- Overview: doc/OVERVIEW.md
- Architecture: doc/ARCHITECTURE.md
- Models: doc/MODELS.md
- Controllers: doc/CONTROLLERS.md
- Wizards: doc/WIZARDS.md
- Reports: doc/REPORTS.md
- Security: doc/SECURITY.md
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md

View file

@ -0,0 +1,32 @@
# Architecture
```mermaid
flowchart TD
U[Users] -->|HTTP| V[Views and QWeb Templates]
V --> C[Controllers]
V --> W[Wizards Transient Models]
C --> M[Models and ORM]
W --> M
M --> R[Reports]
DX[Data XML] --> M
S[Security ACLs and Groups] -. enforces .-> M
subgraph L10n_it_edi_pa Module - l10n_it_edi_pa
direction LR
M:::layer
W:::layer
C:::layer
V:::layer
R:::layer
S:::layer
DX:::layer
end
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
```
Notes
- Views include tree/form/kanban templates and report templates.
- Controllers provide website/portal routes when present.
- Wizards are UI flows implemented with `models.TransientModel`.
- Data XML loads data/demo records; Security defines groups and access.

View file

@ -0,0 +1,3 @@
# Configuration
Refer to Odoo settings for l10n_it_edi_pa. Configure related models, access rights, and options as needed.

View file

@ -0,0 +1,3 @@
# Controllers
This module does not define custom HTTP controllers.

View file

@ -0,0 +1,5 @@
# Dependencies
This addon depends on:
- [l10n_it_edi](../../odoo-bringout-oca-ocb-l10n_it_edi)

View file

@ -0,0 +1,4 @@
# FAQ
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
- Q: How to enable? A: Start server with --addon l10n_it_edi_pa or install in UI.

View file

@ -0,0 +1,7 @@
# Install
```bash
pip install odoo-bringout-oca-ocb-l10n_it_edi_pa"
# or
uv pip install odoo-bringout-oca-ocb-l10n_it_edi_pa"
```

View file

@ -0,0 +1,13 @@
# Models
Detected core models and extensions in l10n_it_edi_pa.
```mermaid
classDiagram
class account_edi_format
class account_move
```
Notes
- Classes show model technical names; fields omitted for brevity.
- Items listed under _inherit are extensions of existing models.

View file

@ -0,0 +1,6 @@
# Overview
Packaged Odoo addon: l10n_it_edi_pa. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon l10n_it_edi_pa
- License: LGPL-3

View file

@ -0,0 +1,3 @@
# Reports
This module does not define custom reports.

View file

@ -0,0 +1,8 @@
# Security
This module does not define custom security rules or access controls beyond Odoo defaults.
Default Odoo security applies:
- Base user access through standard groups
- Model access inherited from dependencies
- No custom row-level security rules

View file

@ -0,0 +1,5 @@
# Troubleshooting
- Ensure Python and Odoo environment matches repo guidance.
- Check database connectivity and logs if startup fails.
- Validate that dependent addons listed in DEPENDENCIES.md are installed.

View file

@ -0,0 +1,7 @@
# Usage
Start Odoo including this addon (from repo root):
```bash
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon l10n_it_edi_pa
```

View file

@ -0,0 +1,3 @@
# Wizards
This module does not include UI wizards.

View file

@ -0,0 +1,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models

View file

@ -0,0 +1,28 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Italy - E-invoicing (PA)',
'version': '0.1',
'depends': [
'l10n_it_edi'
],
'auto_install': ['l10n_it_edi'],
'author': 'Odoo',
'description': """
Public Administration partners flow handling for the E-invoice implementation for Italy.
Several more fields are required for invoicing Public Administration businesses.
The Origin Document is to be exported in the XML when invoicing the Public Administration,
It can be a Contract, an Agreement, a Purchase Order, a Linked Invoice or a Down Payment,
it will need the CIG and CUP fields which are mandatory.
They both serve the purpose to trace public funds being invested on purchases.
CIG is the Tender Unique Identifier, CUP identifies the Public Project of Investment.
""",
'category': 'Accounting/Localizations/EDI',
'website': 'https://www.odoo.com/documentation/16.0/applications/finance/accounting/fiscal_localizations/localizations/italy.html',
'data': [
'views/account_move_view.xml',
'views/report_invoice.xml',
],
'license': 'LGPL-3',
}

View file

@ -0,0 +1,146 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_edi_pa
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-31 09:44+0000\n"
"PO-Revision-Date: 2023-08-31 09:44+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: l10n_it_edi_pa
#: model_terms:ir.ui.view,arch_db:l10n_it_edi_pa.report_invoice_document
msgid "<b>CIG: </b>"
msgstr ""
#. module: l10n_it_edi_pa
#: model_terms:ir.ui.view,arch_db:l10n_it_edi_pa.report_invoice_document
msgid "<b>CUP: </b>"
msgstr ""
#. module: l10n_it_edi_pa
#: model_terms:ir.ui.view,arch_db:l10n_it_edi_pa.report_invoice_document
msgid "<b>Document Date: </b>"
msgstr "<b>Data Documento: </b>"
#. module: l10n_it_edi_pa
#: model:ir.model.fields.selection,name:l10n_it_edi_pa.selection__account_move__l10n_it_origin_document_type__agreement
msgid "Agreement"
msgstr "Convenzione"
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_cig
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_cig
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_cig
msgid "CIG"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_cup
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_cup
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_cup
msgid "CUP"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields.selection,name:l10n_it_edi_pa.selection__account_move__l10n_it_origin_document_type__contract
msgid "Contract"
msgstr "Contratto"
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_partner_pa_index
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_partner_pa_index
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_partner_pa_index
msgid "Destination Code"
msgstr "Codice Destinatario"
#. module: l10n_it_edi_pa
#: model:ir.model,name:l10n_it_edi_pa.model_account_edi_format
msgid "EDI format"
msgstr "Formato EDI"
#. module: l10n_it_edi_pa
#: model:ir.model,name:l10n_it_edi_pa.model_account_move
msgid "Journal Entry"
msgstr "Movimento Contabile"
#. module: l10n_it_edi_pa
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_partner_pa_index
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_move__l10n_it_partner_pa_index
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_payment__l10n_it_partner_pa_index
msgid ""
"Must contain the 6-character (or 7) code, present in the PA "
"Index in the information relative to the electronic invoicing service,"
" associated with the office which, within the addressee "
"administration, deals with receiving (and processing) the "
"invoice."
msgstr ""
"Deve contenere il codice da 6-7 caratteri presente nell'indice della PA "
"nelle informazioni relative al servizio di Fatturazione Elettronica, "
"associato all'ufficio dell'amministrazione che riceverá (ed elaborerá) la "
"Fattura."
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_origin_document_date
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_origin_document_date
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_origin_document_date
msgid "Origin Document Date"
msgstr "Data Documento Origine"
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_origin_document_name
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_origin_document_name
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_origin_document_name
msgid "Origin Document Name"
msgstr "Nome Documento Origine"
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_origin_document_type
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_origin_document_type
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_origin_document_type
msgid "Origin Document Type"
msgstr "Tipo Documento Origine"
#. module: l10n_it_edi_pa
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_cup
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_move__l10n_it_cup
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_payment__l10n_it_cup
msgid "Public Investment Unique Identifier"
msgstr "CUP"
#. module: l10n_it_edi_pa
#: model:ir.model.fields.selection,name:l10n_it_edi_pa.selection__account_move__l10n_it_origin_document_type__purchase_order
msgid "Purchase Order"
msgstr "Ordine d'Acquisto"
#. module: l10n_it_edi_pa
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_cig
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_move__l10n_it_cig
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_payment__l10n_it_cig
msgid "Tender Unique Identifier"
msgstr "CIG"
#. module: l10n_it_edi_pa
#. odoo-python
#: code:addons/l10n_it_edi_pa/models/account_edi_format.py:0
#, python-format
msgid "The Origin Document Date cannot be in the future."
msgstr "La Data Documento Origine non può essere nel futuro."
#. module: l10n_it_edi_pa
#. odoo-python
#: code:addons/l10n_it_edi_pa/models/account_edi_format.py:0
#, python-format
msgid ""
"This invoice targets the Public Administration, please fill out Origin "
"Document Type field in the Electronic Invoicing tab."
msgstr ""
"Questa fattura ha come cliente la Pubblica Amministrazione, per favore "
"riempi il Tipo Documento Origine nel tab Fatturazione Elettronica"

View file

@ -0,0 +1,140 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_edi_pa
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-31 09:43+0000\n"
"PO-Revision-Date: 2023-08-31 09:43+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: l10n_it_edi_pa
#: model_terms:ir.ui.view,arch_db:l10n_it_edi_pa.report_invoice_document
msgid "<b>CIG: </b>"
msgstr ""
#. module: l10n_it_edi_pa
#: model_terms:ir.ui.view,arch_db:l10n_it_edi_pa.report_invoice_document
msgid "<b>CUP: </b>"
msgstr ""
#. module: l10n_it_edi_pa
#: model_terms:ir.ui.view,arch_db:l10n_it_edi_pa.report_invoice_document
msgid "<b>Document Date: </b>"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields.selection,name:l10n_it_edi_pa.selection__account_move__l10n_it_origin_document_type__agreement
msgid "Agreement"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_cig
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_cig
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_cig
msgid "CIG"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_cup
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_cup
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_cup
msgid "CUP"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields.selection,name:l10n_it_edi_pa.selection__account_move__l10n_it_origin_document_type__contract
msgid "Contract"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_partner_pa_index
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_partner_pa_index
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_partner_pa_index
msgid "Destination Code"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model,name:l10n_it_edi_pa.model_account_edi_format
msgid "EDI format"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model,name:l10n_it_edi_pa.model_account_move
msgid "Journal Entry"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_partner_pa_index
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_move__l10n_it_partner_pa_index
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_payment__l10n_it_partner_pa_index
msgid ""
"Must contain the 6-character (or 7) code, present in the PA "
"Index in the information relative to the electronic invoicing service,"
" associated with the office which, within the addressee "
"administration, deals with receiving (and processing) the "
"invoice."
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_origin_document_date
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_origin_document_date
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_origin_document_date
msgid "Origin Document Date"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_origin_document_name
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_origin_document_name
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_origin_document_name
msgid "Origin Document Name"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_origin_document_type
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_move__l10n_it_origin_document_type
#: model:ir.model.fields,field_description:l10n_it_edi_pa.field_account_payment__l10n_it_origin_document_type
msgid "Origin Document Type"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_cup
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_move__l10n_it_cup
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_payment__l10n_it_cup
msgid "Public Investment Unique Identifier"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields.selection,name:l10n_it_edi_pa.selection__account_move__l10n_it_origin_document_type__purchase_order
msgid "Purchase Order"
msgstr ""
#. module: l10n_it_edi_pa
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_bank_statement_line__l10n_it_cig
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_move__l10n_it_cig
#: model:ir.model.fields,help:l10n_it_edi_pa.field_account_payment__l10n_it_cig
msgid "Tender Unique Identifier"
msgstr ""
#. module: l10n_it_edi_pa
#. odoo-python
#: code:addons/l10n_it_edi_pa/models/account_edi_format.py:0
#, python-format
msgid "The Origin Document Date cannot be in the future."
msgstr ""
#. module: l10n_it_edi_pa
#. odoo-python
#: code:addons/l10n_it_edi_pa/models/account_edi_format.py:0
#, python-format
msgid ""
"This invoice targets the Public Administration, please fill out Origin "
"Document Type field in the Electronic Invoicing tab."
msgstr ""

View file

@ -0,0 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_move
from . import account_edi_format

View file

@ -0,0 +1,17 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import _, fields, models
class AccountEdiFormat(models.Model):
_inherit = 'account.edi.format'
def _l10n_it_edi_check_ordinary_invoice_configuration(self, invoice):
errors = super()._l10n_it_edi_check_ordinary_invoice_configuration(invoice)
if invoice._is_commercial_partner_pa():
if not invoice.l10n_it_origin_document_type:
errors.append(_("This invoice targets the Public Administration, please fill out"
" Origin Document Type field in the Electronic Invoicing tab."))
if invoice.l10n_it_origin_document_date and invoice.l10n_it_origin_document_date > fields.Date.today():
errors.append(_("The Origin Document Date cannot be in the future."))
return errors

View file

@ -0,0 +1,46 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class AccountMove(models.Model):
_inherit = 'account.move'
l10n_it_origin_document_type = fields.Selection(
string="Origin Document Type",
selection=[('purchase_order', 'Purchase Order'), ('contract', 'Contract'), ('agreement', 'Agreement')],
readonly=True, states={'draft': [('readonly', False)]}, copy=False)
l10n_it_origin_document_name = fields.Char(
string="Origin Document Name",
readonly=True, states={'draft': [('readonly', False)]}, copy=False)
l10n_it_origin_document_date = fields.Date(
string="Origin Document Date",
readonly=True, states={'draft': [('readonly', False)]}, copy=False)
l10n_it_cig = fields.Char(
string="CIG",
readonly=True, states={'draft': [('readonly', False)]}, copy=False,
help="Tender Unique Identifier")
l10n_it_cup = fields.Char(
string="CUP",
readonly=True, states={'draft': [('readonly', False)]}, copy=False,
help="Public Investment Unique Identifier")
# Technical field for showing the above fields or not
l10n_it_partner_pa = fields.Boolean(compute='_compute_l10n_it_partner_pa')
@api.depends('commercial_partner_id.l10n_it_pa_index', 'company_id')
def _compute_l10n_it_partner_pa(self):
for move in self:
move.l10n_it_partner_pa = (move.country_code == 'IT' and move.commercial_partner_id.l10n_it_pa_index and
len(move.commercial_partner_id.l10n_it_pa_index) == 6)
def _prepare_fatturapa_export_values(self):
"""Add origin document features."""
template_values = super()._prepare_fatturapa_export_values()
template_values.update({
'origin_document_type': self.l10n_it_origin_document_type,
'origin_document_name': self.l10n_it_origin_document_name,
'origin_document_date': self.l10n_it_origin_document_date,
'cig': self.l10n_it_cig,
'cup': self.l10n_it_cup,
})
return template_values

View file

@ -0,0 +1,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_edi_pa

View file

@ -0,0 +1,85 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
from lxml import etree
from odoo.addons.l10n_it_edi.tests.common import TestItEdi
from odoo.exceptions import UserError
from odoo.tests.common import tagged
from odoo import tools
@tagged('post_install_l10n', 'post_install', '-at_install')
class TestItEdiPa(TestItEdi):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.Move = cls.env['account.move'].with_company(cls.company)
journal_code = cls.company_data_2['default_journal_sale'].code
cls.split_payment_tax = cls.env['account.tax'].with_company(cls.company).search([('name', '=', '22% SP')])
cls.split_payment_line_data = {
**cls.standard_line,
'tax_ids': [(6, 0, [cls.split_payment_tax.id])]
}
cls.pa_partner_invoice_data = {
'move_type': 'out_invoice',
'invoice_date': datetime.date(2022, 3, 24),
'invoice_date_due': datetime.date(2022, 3, 24),
'partner_id': cls.italian_partner_b.id,
'partner_bank_id': cls.test_bank.id,
'invoice_line_ids': [
(0, 0, cls.split_payment_line_data),
],
'l10n_it_origin_document_type': 'purchase_order',
'l10n_it_origin_document_date': datetime.date(2022, 3, 23),
'l10n_it_origin_document_name': f"{journal_code}/2022/0001",
'l10n_it_cup': '0123456789',
'l10n_it_cig': '0987654321'
}
cls.pa_partner_invoice = cls.Move.create(cls.pa_partner_invoice_data)
cls.pa_partner_invoice_2 = cls.Move.create({
**cls.pa_partner_invoice_data,
'l10n_it_origin_document_type': False,
})
cls.pa_partner_invoice._post()
cls.split_payment_invoice_content = cls._get_test_file_content('split_payment.xml')
@classmethod
def _get_test_file_content(cls, filename):
""" Get the content of a test file inside this module """
path = 'l10n_it_edi/tests/expected_xmls/' + filename
with tools.file_open(path, mode='rb') as test_file:
return test_file.read()
def test_send_pa_partner(self):
res = self.edi_format._l10n_it_post_invoices_step_1(self.pa_partner_invoice)
self.assertEqual(res[self.pa_partner_invoice], {'attachment': self.pa_partner_invoice.l10n_it_edi_attachment_id, 'success': True})
def test_send_pa_partner_missing_field(self):
with self.assertRaises(UserError):
self.pa_partner_invoice_2._post()
def test_split_payment(self):
""" ImportoTotaleDocumento must include VAT
ImportoPagamento must be without VAT
EsigibilitaIva of the Split payment tax must be 'S'
The orgin_document fields must appear in the XML.
Use reference validator: https://fex-app.com/servizi/inizia
"""
invoice_etree = self._cleanup_etree(self.edi_format._l10n_it_edi_export_invoice_as_xml(self.pa_partner_invoice))
expected_etree = etree.fromstring(self.split_payment_invoice_content)
self.assertXmlTreeEqual(invoice_etree, expected_etree)
split_payment_credit_note_content = self._get_test_file_content('split_payment_cn.xml')
expected_cn_etree = etree.fromstring(split_payment_credit_note_content)
credit_note_wizard = self.env['account.move.reversal'] \
.with_context(active_model='account.move', active_ids=self.pa_partner_invoice.ids) \
.create({
'date': datetime.date(2022, 3, 25),
'journal_id': self.pa_partner_invoice.journal_id.id,
})
credit_note_wizard.reverse_moves()
credit_note = self.env['account.move'].search([('reversed_entry_id', '=', self.pa_partner_invoice.id)])
cn_etree = self._cleanup_etree(self.edi_format._l10n_it_edi_export_invoice_as_xml(credit_note))
self.assertXmlTreeEqual(cn_etree, expected_cn_etree)

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_invoice_form_l10n_it_pa" model="ir.ui.view">
<field name="name">account.move.form.l10n.it.pa</field>
<field name="model">account.move</field>
<field name="priority">20</field>
<field name="inherit_id" ref="l10n_it_edi.account_invoice_form_l10n_it"/>
<field name="arch" type="xml">
<data>
<xpath expr="//page[@name='electronic_invoicing']/group" position="inside">
<field name="l10n_it_partner_pa" invisible="1"/>
<group attrs="{'invisible': [('l10n_it_partner_pa', '=', False)]}">
<field name="l10n_it_origin_document_type"/>
<field name="l10n_it_origin_document_name"/>
<field name="l10n_it_origin_document_date"/>
<field name="l10n_it_cig"/>
<field name="l10n_it_cup"/>
</group>
</xpath>
</data>
</field>
</record>
</odoo>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<div name="comment" position="before">
<div t-if="o.l10n_it_origin_document_type" name="pa_fields">
<b><span t-field="o.l10n_it_origin_document_type"/></b>: <span t-field="o.l10n_it_origin_document_name"/><br/>
<t t-if="o.l10n_it_origin_document_date"><b>Document Date: </b><span t-field="o.l10n_it_origin_document_date"/><br/></t>
<t t-if="o.l10n_it_cig"><b>CIG: </b><span t-field="o.l10n_it_cig"/><br/></t>
<t t-if="o.l10n_it_cup"><b>CUP: </b><span t-field="o.l10n_it_cup"/><br/></t>
</div>
</div>
</template>
</odoo>

View file

@ -0,0 +1,42 @@
[project]
name = "odoo-bringout-oca-ocb-l10n_it_edi_pa"
version = "16.0.0"
description = "Italy - E-invoicing (PA) - Odoo addon"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-ocb-l10n_it_edi>=16.0.0",
"requests>=2.25.1"
]
readme = "README.md"
requires-python = ">= 3.11"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
]
[project.urls]
homepage = "https://github.com/bringout/0"
repository = "https://github.com/bringout/0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["l10n_it_edi_pa"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]