Skip to content

Commit

Permalink
[IMP] l10n_es_facturae: Allow to add extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinafernandez-tecnativa authored and pilarvargas-tecnativa committed Oct 30, 2024
1 parent c57bd56 commit 7e7415f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion l10n_es_facturae/data/Facturaev3_2.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@
</xs:complexType>
<xs:complexType name="ExtensionsType">
<xs:sequence>
<xs:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AccountType">
Expand Down
2 changes: 1 addition & 1 deletion l10n_es_facturae/data/Facturaev3_2_1.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@
</xs:complexType>
<xs:complexType name="ExtensionsType">
<xs:sequence>
<xs:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AccountType">
Expand Down
2 changes: 1 addition & 1 deletion l10n_es_facturae/data/Facturaev3_2_2.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@
</xs:complexType>
<xs:complexType name="ExtensionsType">
<xs:sequence>
<xs:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AccountType">
Expand Down
6 changes: 6 additions & 0 deletions l10n_es_facturae/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ def get_facturae_version(self):
or "3_2"
)

def _get_facturae_headers(self):
return 'xmlns:ds="http://www.w3.org/2000/09/xmldsig#"'

def _facturae_has_extensions(self):
return False

def _get_facturae_tax_info(self):
self.ensure_one()
sign = -1 if self.move_type[:3] == "out" else 1
Expand Down
24 changes: 15 additions & 9 deletions l10n_es_facturae/views/report_facturae.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,29 @@
</record>
<template id="facturae_header">
<t t-if="version == '3_2'">
&lt;fe:Facturae xmlns:fe="http://www.facturae.es/Facturae/2009/v3.2/Facturae"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
&lt;fe:Facturae xmlns:fe="http://www.facturae.es/Facturae/2009/v3.2/Facturae" <t
t-raw="headers"
/> &gt;
<t t-out="0" />
&lt;/fe:Facturae&gt;
</t>
<t t-elif="version == '3_2_1'">
&lt;fe:Facturae xmlns:fe="http://www.facturae.es/Facturae/2014/v3.2.1/Facturae"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
&lt;fe:Facturae xmlns:fe="http://www.facturae.es/Facturae/2014/v3.2.1/Facturae" <t
t-raw="headers"
/> &gt;
<t t-out="0" />
&lt;/fe:Facturae&gt;
</t>
<t t-elif="version == '3_2_2'">
&lt;fe:Facturae xmlns:fe="http://www.facturae.gob.es/formato/Versiones/Facturaev3_2_2.xml"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
&lt;fe:Facturae xmlns:fe="http://www.facturae.gob.es/formato/Versiones/Facturaev3_2_2.xml" <t
t-raw="headers"
/> &gt;
<t t-out="0" />
&lt;/fe:Facturae&gt;
</t>
</template>
<template id="administrative_center">
<AdministrativeCentre>
<AdministrativeCentre t-if="centre_code">
<CentreCode t-length="10" t-esc="centre_code" />
<RoleTypeCode t-esc="role_type_code" />
<Name
Expand Down Expand Up @@ -189,6 +192,7 @@
<t t-set="currency_rate" t-value="currency.rate if currency else 1.0" />
<t t-set="euro_rate" t-value="euro.rate if euro else 1.0" />
<t t-set="version" t-value="move.get_facturae_version()" />
<t t-set="headers" t-value="move._get_facturae_headers()" />
<t t-call="l10n_es_facturae.facturae_header">
<FileHeader>
<SchemaVersion
Expand Down Expand Up @@ -728,7 +732,9 @@
t-set="attachments"
t-value="move._get_facturae_move_attachments()"
/>
<AdditionalData t-if="move.get_narration() or attachments">
<AdditionalData
t-if="move.narration or attachments or move._facturae_has_extensions()"
>
<RelatedInvoice t-if="False" />
<RelatedDocuments t-if="attachments">
<Attachment t-foreach="attachments" t-as="attachment">
Expand All @@ -753,7 +759,7 @@
t-esc="move.get_narration()"
t-if="move.get_narration()"
/>
<Extensions t-if="False" />
<Extensions t-if="move._facturae_has_extensions()" />
</AdditionalData>
</Invoice>
</Invoices>
Expand Down

0 comments on commit 7e7415f

Please sign in to comment.