-
-
Notifications
You must be signed in to change notification settings - Fork 344
[18.0][IMP] l10n_it_accompanying_invoice: handler for adding transport data in XML #4985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,98 @@ | ||||||||
| <?xml version="1.0" encoding="utf-8" ?> | ||||||||
| <odoo> | ||||||||
| <template | ||||||||
| id="account_invoice_it_FatturaPA_export_accompanying_inherit" | ||||||||
| inherit_id="l10n_it_edi_extension.account_invoice_it_FatturaPA_export_inherit" | ||||||||
| > | ||||||||
| <xpath expr="//DatiTrasporto/IndirizzoResa" position="before"> | ||||||||
| <!-- 2.1.9.1 --> | ||||||||
| <DatiAnagraficiVettore t-if="delivery_carrier_info"> | ||||||||
| <IdFiscaleIVA> | ||||||||
| <IdPaese t-out="delivery_carrier_info['country_code']" /> | ||||||||
| <IdCodice t-out="delivery_carrier_info['vat']" /> | ||||||||
| </IdFiscaleIVA> | ||||||||
| <CodiceFiscale | ||||||||
| t-if="delivery_carrier_info['codice_fiscale']" | ||||||||
| t-out="delivery_carrier_info['codice_fiscale']" | ||||||||
| /> | ||||||||
| <Anagrafica> | ||||||||
| <t t-if="delivery_carrier_info['is_company']"> | ||||||||
| <Denominazione | ||||||||
| t-out="format_alphanumeric(record.delivery_carrier_id.display_name, 80)" | ||||||||
| /> | ||||||||
| </t> | ||||||||
| <t t-else=""> | ||||||||
| <Nome | ||||||||
| t-out="format_alphanumeric(delivery_carrier_info['first_name'], 60)" | ||||||||
| /> | ||||||||
| <Cognome | ||||||||
| t-out="format_alphanumeric(delivery_carrier_info['last_name'], 60)" | ||||||||
| /> | ||||||||
| </t> | ||||||||
| </Anagrafica> | ||||||||
| </DatiAnagraficiVettore> | ||||||||
|
|
||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perché non c'è anche |
||||||||
| <!-- 2.1.9.2 --> | ||||||||
| <MezzoTrasporto | ||||||||
| t-if="record.delivery_transport_method_id" | ||||||||
| t-out="record.delivery_transport_method_id.display_name" | ||||||||
| /> | ||||||||
|
|
||||||||
| <!-- 2.1.9.3 --> | ||||||||
| <CausaleTrasporto | ||||||||
| t-if="record.delivery_transport_reason_id" | ||||||||
| t-out="record.delivery_transport_reason_id.display_name" | ||||||||
| /> | ||||||||
|
|
||||||||
| <!-- 2.1.9.4 --> | ||||||||
| <NumeroColli | ||||||||
| t-if="record.delivery_packages" | ||||||||
| t-out="record.delivery_packages" | ||||||||
| /> | ||||||||
|
|
||||||||
| <!-- 2.1.9.5 --> | ||||||||
| <Descrizione | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Qui manca
Suggested change
|
||||||||
| t-if="record.delivery_goods_appearance_id" | ||||||||
| t-out="record.delivery_goods_appearance_id.display_name" | ||||||||
| /> | ||||||||
|
|
||||||||
| <!-- 2.1.9.6 --> | ||||||||
| <t | ||||||||
| t-set="weight_uom" | ||||||||
| t-value="record.delivery_gross_weight_uom_id or record.delivery_net_weight_uom_id" | ||||||||
| /> | ||||||||
| <UnitaMisuraPeso t-if="weight_uom" t-out="weight_uom.display_name" /> | ||||||||
|
|
||||||||
| <!-- 2.1.9.7 --> | ||||||||
| <PesoLordo | ||||||||
| t-if="record.delivery_gross_weight" | ||||||||
| t-out="record.delivery_gross_weight" | ||||||||
| /> | ||||||||
|
|
||||||||
| <!-- 2.1.9.8 --> | ||||||||
| <PesoNetto | ||||||||
| t-if="record.delivery_net_weight" | ||||||||
| t-out="record.delivery_net_weight" | ||||||||
| /> | ||||||||
|
|
||||||||
| <!-- 2.1.9.9 --> | ||||||||
| <!-- <DataOraRitiro t-out="format_date() /> --> | ||||||||
|
|
||||||||
| <!-- 2.1.9.10 --> | ||||||||
| <DataInizioTrasporto | ||||||||
| t-if="record.delivery_transport_datetime" | ||||||||
| t-out="format_date(record.delivery_transport_datetime)" | ||||||||
| /> | ||||||||
|
|
||||||||
| <!-- 2.1.9.11 --> | ||||||||
| <TipoResa | ||||||||
| t-if="record.invoice_incoterm_id" | ||||||||
| t-out="record.invoice_incoterm_id.code" | ||||||||
| /> | ||||||||
| </xpath> | ||||||||
| <!-- <xpath expr="//DatiTrasporto/IndirizzoResa" position="after"> --> | ||||||||
| <!-- 2.1.9.13 --> | ||||||||
| <!-- <DataOraConsegna t-out="format_date() /> --> | ||||||||
| <!-- </xpath> --> | ||||||||
| </template> | ||||||||
| </odoo> | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| <?xml version='1.0' encoding='UTF-8' ?> | ||
| <p:FatturaElettronica | ||
| xmlns:p="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xmlns:ds="http://www.w3.org/2000/09/xmldsig#" | ||
| xsi:schemaLocation="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2 http://www.fatturapa.gov.it/export/fatturazione/sdi/fatturapa/v1.2/Schema_del_file_xml_FatturaPA_versione_1.2.xsd" | ||
| versione="FPR12" | ||
| > | ||
| <FatturaElettronicaHeader> | ||
| <DatiTrasmissione> | ||
| <IdTrasmittente> | ||
| <IdPaese>IT</IdPaese> | ||
| <IdCodice>01234560157</IdCodice> | ||
| </IdTrasmittente> | ||
| <ProgressivoInvio>V201900001</ProgressivoInvio> | ||
| <FormatoTrasmissione>FPR12</FormatoTrasmissione> | ||
| <CodiceDestinatario>0000000</CodiceDestinatario> | ||
| <ContattiTrasmittente> | ||
| <Telefono>0266766700</Telefono> | ||
| <Email>test@test.it</Email> | ||
| </ContattiTrasmittente> | ||
| </DatiTrasmissione> | ||
| <CedentePrestatore> | ||
| <DatiAnagrafici> | ||
| <IdFiscaleIVA> | ||
| <IdPaese>IT</IdPaese> | ||
| <IdCodice>01234560157</IdCodice> | ||
| </IdFiscaleIVA> | ||
| <CodiceFiscale>01234560157</CodiceFiscale> | ||
| <Anagrafica> | ||
| <Denominazione>company_2_data</Denominazione> | ||
| </Anagrafica> | ||
| <RegimeFiscale>RF01</RegimeFiscale> | ||
| </DatiAnagrafici> | ||
| <Sede> | ||
| <Indirizzo>1234 Test Street</Indirizzo> | ||
| <CAP>12345</CAP> | ||
| <Comune>Prova</Comune> | ||
| <Nazione>IT</Nazione> | ||
| </Sede> | ||
| </CedentePrestatore> | ||
| <CessionarioCommittente> | ||
| <DatiAnagrafici> | ||
| <IdFiscaleIVA> | ||
| <IdPaese>IT</IdPaese> | ||
| <IdCodice>00465840031</IdCodice> | ||
| </IdFiscaleIVA> | ||
| <CodiceFiscale>93026890017</CodiceFiscale> | ||
| <Anagrafica> | ||
| <Denominazione>Alessi</Denominazione> | ||
| </Anagrafica> | ||
| </DatiAnagrafici> | ||
| <Sede> | ||
| <Indirizzo>Via Privata Alessi 6</Indirizzo> | ||
| <CAP>28887</CAP> | ||
| <Comune>Milan</Comune> | ||
| <Nazione>IT</Nazione> | ||
| </Sede> | ||
| </CessionarioCommittente> | ||
| </FatturaElettronicaHeader> | ||
| <FatturaElettronicaBody> | ||
| <DatiGenerali> | ||
| <DatiGeneraliDocumento> | ||
| <TipoDocumento>TD01</TipoDocumento> | ||
| <Divisa>EUR</Divisa> | ||
| <Data>2019-01-01</Data> | ||
| <Numero>INV/2019/00001</Numero> | ||
| <ImportoTotaleDocumento>122.00</ImportoTotaleDocumento> | ||
| </DatiGeneraliDocumento> | ||
| <DatiTrasporto> | ||
| <DatiAnagraficiVettore> | ||
| <IdFiscaleIVA> | ||
| <IdPaese>IT</IdPaese> | ||
| <IdCodice>12345678903</IdCodice> | ||
| </IdFiscaleIVA> | ||
| <Anagrafica> | ||
| <Denominazione>Italian Carrier</Denominazione> | ||
| </Anagrafica> | ||
| </DatiAnagraficiVettore> | ||
| <MezzoTrasporto>Sender</MezzoTrasporto> | ||
| <CausaleTrasporto>Sale</CausaleTrasporto> | ||
| <NumeroColli>1</NumeroColli> | ||
| <Descrizione>Box</Descrizione> | ||
| <UnitaMisuraPeso>kg</UnitaMisuraPeso> | ||
| <PesoLordo>10.00</PesoLordo> | ||
| <PesoNetto>9.50</PesoNetto> | ||
| <DataInizioTrasporto>2025-11-06</DataInizioTrasporto> | ||
| <TipoResa>CPT</TipoResa> | ||
| <IndirizzoResa> | ||
| <Indirizzo>Largo S. Martino 1</Indirizzo> | ||
| <CAP>80129</CAP> | ||
| <Comune>Napoli</Comune> | ||
| <Nazione>IT</Nazione> | ||
| </IndirizzoResa> | ||
| </DatiTrasporto> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. La maggior parte dei nuovi nodi aggiunti non vengono inseriti nel XML anche se nel test vengono assegnati: italian_partner.default_transport_condition_id = self.env.ref(
"l10n_it_delivery_note.transport_condition_PF"
)
italian_partner.default_goods_appearance_id = self.env.ref(
"l10n_it_delivery_note.goods_appearance_CAR"
)
italian_partner.default_transport_reason_id = self.env.ref(
"l10n_it_delivery_note.transport_reason_VEN"
)
italian_partner.default_transport_method_id = self.env.ref(
"l10n_it_delivery_note.transport_method_MIT"
)Manca anche tutto |
||
| </DatiGenerali> | ||
| <DatiBeniServizi> | ||
| <DettaglioLinee> | ||
| <NumeroLinea>1</NumeroLinea> | ||
| <Descrizione>test line</Descrizione> | ||
| <Quantita>1.00</Quantita> | ||
| <PrezzoUnitario>100.00000000</PrezzoUnitario> | ||
| <PrezzoTotale>100.00000000</PrezzoTotale> | ||
| <AliquotaIVA>22.00</AliquotaIVA> | ||
| </DettaglioLinee> | ||
| <DatiRiepilogo> | ||
| <AliquotaIVA>22.00</AliquotaIVA> | ||
| <ImponibileImporto>100.00</ImponibileImporto> | ||
| <Imposta>22.00</Imposta> | ||
| <EsigibilitaIVA>I</EsigibilitaIVA> | ||
| </DatiRiepilogo> | ||
| </DatiBeniServizi> | ||
| <DatiPagamento> | ||
| <CondizioniPagamento>TP02</CondizioniPagamento> | ||
| <DettaglioPagamento> | ||
| <ModalitaPagamento>MP05</ModalitaPagamento> | ||
| <DataScadenzaPagamento>2019-01-01</DataScadenzaPagamento> | ||
| <ImportoPagamento>122.00</ImportoPagamento> | ||
| <CodicePagamento>INV/2019/00001</CodicePagamento> | ||
| </DettaglioPagamento> | ||
| </DatiPagamento> | ||
| </FatturaElettronicaBody> | ||
| </p:FatturaElettronica> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Copyright 2025 Giuseppe Borruso - Dinamiche Aziendali srl | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
|
|
||
| from odoo import fields | ||
| from odoo.tests import tagged | ||
|
|
||
| from odoo.addons.l10n_it_edi_extension.tests.common import Common | ||
|
|
||
|
|
||
| @tagged("post_install", "-at_install") | ||
| class TestAccountMoveExport(Common): | ||
| @classmethod | ||
| def setUpClass(cls): | ||
| super().setUpClass() | ||
| cls.module = "l10n_it_accompanying_invoice" | ||
|
|
||
| cls.italian_delivery_carrier = cls.env["res.partner"].create( | ||
| { | ||
| "name": "Italian Carrier", | ||
| "vat": "IT12345678903", | ||
| "country_id": cls.env.ref("base.it").id, | ||
| "company_id": False, | ||
| "is_company": True, | ||
| } | ||
| ) | ||
|
|
||
| def test_export_delivery_data(self): | ||
| italian_partner = self.italian_partner_a | ||
| italian_partner.default_transport_condition_id = self.env.ref( | ||
| "l10n_it_delivery_note.transport_condition_PF" | ||
| ) | ||
| italian_partner.default_goods_appearance_id = self.env.ref( | ||
| "l10n_it_delivery_note.goods_appearance_CAR" | ||
| ) | ||
| italian_partner.default_transport_reason_id = self.env.ref( | ||
| "l10n_it_delivery_note.transport_reason_VEN" | ||
| ) | ||
| italian_partner.default_transport_method_id = self.env.ref( | ||
| "l10n_it_delivery_note.transport_method_MIT" | ||
| ) | ||
|
|
||
| invoice = self.init_invoice( | ||
| "out_invoice", | ||
| amounts=[100], | ||
| company=self.company, | ||
| partner=italian_partner, | ||
| taxes=self.default_tax, | ||
| ) | ||
| invoice.write( | ||
| { | ||
| "partner_shipping_id": self.italian_shipping_partner_a.id, | ||
| "delivery_carrier_id": self.italian_delivery_carrier.id, | ||
| "delivery_packages": 1, | ||
| "delivery_gross_weight": 10.0, | ||
| "delivery_net_weight": 9.5, | ||
| "delivery_transport_datetime": fields.Date.from_string("2025-11-06"), | ||
| "invoice_incoterm_id": self.env.ref("account.incoterm_CPT").id, | ||
| } | ||
| ) | ||
| invoice.action_post() | ||
| self._assert_export_invoice(invoice, "delivery_data.xml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oltra ai nodi che ho segnalato, mancano anche:
DataOraRitiroDataOraConsegnaNon so però se abbiamo il dato da poterci mettere o se lo vogliamo mettere in generale, mi rimetto al parere dei funzionali 🙏