Skip to content

Commit

Permalink
[FIX] l10n_it_fatturapa_out_sp: get it compatible with l10n_it_fattur…
Browse files Browse the repository at this point in the history
…apa_out_rc

Also note that it's not possible create a selfinvoice with split payment.

Otherwise if both modules are installed you get the following error:

2021-12-16 15:00:57,290 943831 ERROR test-l10n_it_fatturapa_out_rc_14.0 odoo.addons.l10n_it_fatturapa_out_rc.tests.test_fatturapa_xml_validation: ERROR: TestFatturaPAXMLValidation.test_intra_EU_supplier_refund
Traceback (most recent call last):
  File "/home/tafaru/dev/envs/odoo14/l10n-italy/l10n_it_fatturapa_out_rc/tests/test_fatturapa_xml_validation.py", line 192, in test_intra_EU_supplier_refund
    res = self.run_wizard(invoice.rc_self_invoice_id.id)
  File "/home/tafaru/dev/envs/odoo14/l10n-italy/l10n_it_fatturapa_out/tests/fatturapa_common.py", line 187, in run_wizard
    return wizard.with_context({"active_ids": [invoice_id]}).exportFatturaPA()
  File "/home/tafaru/dev/envs/odoo14/l10n-italy/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py", line 151, in exportFatturaPA
    attach = self.saveAttachment(fatturapa, progressivo_invio)
  File "/home/tafaru/dev/envs/odoo14/l10n-italy/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py", line 52, in saveAttachment
    attach_str = fatturapa.to_xml(self.env)
  File "/home/tafaru/dev/envs/odoo14/l10n-italy/l10n_it_fatturapa_out/wizard/efattura.py", line 320, in to_xml
    raise UserError("\n".join(str(e) for e in errors))
odoo.exceptions.UserError: failed validating <Element DatiGeneraliDocumento at 0x7fecc1bbbac8> with XsdGroup(model='sequence', occurs=[1, 1]):

Reason: Unexpected child with tag 'ImportoTotaleDocumento' at position 6.

Schema:

  <xs:complexType xmlns:xs="http://www.w3.org/2001/XMLSchema" name="DatiGeneraliDocumentoType">
    <xs:sequence>
      <xs:element name="TipoDocumento" type="TipoDocumentoType" />
      <xs:element name="Divisa" type="DivisaType" />
      <xs:element name="Data" type="DataFatturaType" />
      <xs:element name="Numero" type="String20Type" />
      <xs:element maxOccurs="unbounded" minOccurs="0" name="DatiRitenuta" type="DatiRitenutaType" />
      <xs:element minOccurs="0" name="DatiBollo" type="DatiBolloType" />
      <xs:element maxOccurs="unbounded" minOccurs="0" name="DatiCassaPrevidenziale" type="DatiCassaPrevidenzialeType" />
      <xs:element maxOccurs="unbounded" minOccurs="0" name="ScontoMaggiorazione" type="ScontoMaggiorazioneType" />
      <xs:element minOccurs="0" name="ImportoTotaleDocumento" type="Amount2DecimalType" />
      <xs:element minOccurs="0" name="Arrotondamento" type="Amount2DecimalType" />
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Causale" type="String200LatinType" />
      <xs:element minOccurs="0" name="Art73" type="Art73Type" />
    </xs:sequence>
  </xs:complexType>

Instance (line 130):

  <DatiGeneraliDocumento xmlns:ns1="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2"><TipoDocumento>TD17</TipoDocumento><Divisa>EUR</Divisa><Data>2020-12-01</Data><Numero>RSLF/2020/12/0001</Numero><ImportoTotaleDocumento>-122.00</ImportoTotaleDocumento><ImportoTotaleDocumento>122.00</ImportoTotaleDocumento><Causale>Reverse charge self invoice.</Causale><Causale>Supplier: Intra EU supplier</Causale><Causale>Reference: EU-SUPPLIER-REF</Causale><Causale>Date: 2020-12-01</Causale><Causale>Internal reference: RBILL/2020/12/0001</Causale></DatiGeneraliDocumento>

Path: /ns1:FatturaElettronica/FatturaElettronicaBody/DatiGenerali/DatiGeneraliDocumento
  • Loading branch information
tafaRU committed Dec 24, 2021
1 parent f7d732e commit 76abedc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions l10n_it_fatturapa_out_sp/view/invoice_it_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
inherit_id="l10n_it_fatturapa_out.account_invoice_it_fattura_elettronica_body"
>
<xpath expr="//ImportoTotaleDocumento" position="replace">
<ImportoTotaleDocumento
t-if="record.split_payment"
t-esc="format_numbers_two(record.amount_total + record.amount_sp)"
/>
<ImportoTotaleDocumento
t-if="not record.split_payment"
t-esc="format_numbers_two(record.amount_total)"
/>
<ImportoTotaleDocumento
t-if="record.split_payment"
t-esc="format_numbers_two(record.amount_total + record.amount_sp)"
/>
</xpath>
</template>
</odoo>

0 comments on commit 76abedc

Please sign in to comment.