parent
3b6d38630f
commit
780b64789a
4
party.py
4
party.py
|
@ -20,3 +20,7 @@ class Party:
|
||||||
('U', 'Resident in other EU country'),
|
('U', 'Resident in other EU country'),
|
||||||
('E', 'Foreigner'),
|
('E', 'Foreigner'),
|
||||||
], 'Residence Type', sort=False)
|
], 'Residence Type', sort=False)
|
||||||
|
oficina_contable = fields.Char('Oficina contable')
|
||||||
|
organo_gestor = fields.Char('Organo gestor')
|
||||||
|
unidad_tramitadora = fields.Char('Unidad tramitadora')
|
||||||
|
organo_proponente = fields.Char('Organo proponente')
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
{% from "template_facturae_macros.xml" import administrative_center, address, contact %}<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
<namespace:Facturae xmlns:namespace2="http://uri.etsi.org/01903/v1.2.2#" xmlns:namespace3="http://www.w3.org/2000/09/xmldsig#" xmlns:namespace="http://www.facturae.es/Facturae/2014/v3.2.1/Facturae">
|
<namespace:Facturae xmlns:namespace2="http://uri.etsi.org/01903/v1.2.2#" xmlns:namespace3="http://www.w3.org/2000/09/xmldsig#" xmlns:namespace="http://www.facturae.es/Facturae/2014/v3.2.1/Facturae">
|
||||||
<FileHeader>
|
<FileHeader>
|
||||||
<SchemaVersion>3.2.1</SchemaVersion>
|
<SchemaVersion>3.2.1</SchemaVersion>
|
||||||
|
@ -43,52 +43,27 @@
|
||||||
</TaxIdentification>
|
</TaxIdentification>
|
||||||
{# Optional. It could be the ID or the code #}
|
{# Optional. It could be the ID or the code #}
|
||||||
{% if invoice.company.party.code and invoice.company.party.code | length < 10 %}
|
{% if invoice.company.party.code and invoice.company.party.code | length < 10 %}
|
||||||
<PartyIdentification>{{ invoice.company.party.code }}</PartyIdentification>
|
<PartyIdentification>{{ invoice.company.party.code|int or invoice.company.party.id }}</PartyIdentification>
|
||||||
|
{% endif %}
|
||||||
|
{% if invoice.company.party.oficina_contable or invoice.company.party.organo_gestor or invoice.company.party.unidad_tramitadora or invoice.company.party.organo_proponente %}
|
||||||
|
<AdministrativeCentres>
|
||||||
|
{% if invoice.company.party.oficina_contable %}{{ administrative_center(invoice.company.party.oficina_contable, '01', invoice.company.party) }}{% endif %}
|
||||||
|
{% if invoice.company.party.organo_gestor %}{{ administrative_center(invoice.company.party.organo_gestor, '02', invoice.company.party) }}{% endif %}
|
||||||
|
{% if invoice.company.party.unidad_tramitadora %}{{ administrative_center(invoice.company.party.unidad_tramitadora, '03', invoice.company.party) }}{% endif %}
|
||||||
|
{% if invoice.company.party.organo_proponente %}{{ administrative_center(invoice.company.party.organo_proponente, '04', invoice.company.party) }}{% endif %}
|
||||||
|
</AdministrativeCentres>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# AdministrativeCentres optional: not supported #}
|
|
||||||
<LegalEntity>
|
<LegalEntity>
|
||||||
<CorporateName>{{ invoice.company.party.name[:80] }}</CorporateName>
|
<CorporateName>{{ invoice.company.party.name[:80] }}</CorporateName>
|
||||||
{% if invoice.company.party.trade_name %}
|
{% if invoice.company.party.trade_name %}
|
||||||
<TradeName>{{ invoice.company.party.trade_name[:40] }}</TradeName>
|
<TradeName>{{ invoice.company.party.trade_name[:40] }}</TradeName>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# RegistrationData optional: not supported #}
|
{# RegistrationData optional: not supported #}
|
||||||
{% if invoice.company.party.addresses[0].country.code == 'ES' %}
|
{% if invoice.company.party.addresses %}
|
||||||
<AddressInSpain>
|
{{ address(invoice.company.party.addresses[0]) }}
|
||||||
<Address>{{ invoice.company.party.addresses[0].street[:80] }}</Address>
|
|
||||||
<PostCode>{{ invoice.company.party.addresses[0].zip[:5] }}</PostCode>
|
|
||||||
<Town>{{ invoice.company.party.addresses[0].city[:50] }}</Town>
|
|
||||||
<Province>{{ invoice.company.party.addresses[0].subdivision.name[:20] }}</Province>
|
|
||||||
<CountryCode>{{ invoice.company.party.addresses[0].country.code3 }}</CountryCode>
|
|
||||||
</AddressInSpain>
|
|
||||||
{% else %}
|
|
||||||
<OverseasAddress>
|
|
||||||
<Address>{{ invoice.company.party.addresses[0].street[:80] }}</Address>
|
|
||||||
<PostCodeAndTown>{{ (', '.join(invoice.company.party.addresses[0].zip, invoice.company.party.addresses[0].city))[:50] }}</PostCode>
|
|
||||||
<Province>{{ invoice.company.party.addresses[0].subdivision.name[:20] }}</Province>
|
|
||||||
<CountryCode>{{ invoice.company.party.addresses[0].country.code3 }}</CountryCode>
|
|
||||||
</OverseasAddress>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if invoice.company.party.phone or invoice.company.party.mobile or invoice.company.party.fax or invoice.company.party.website or invoice.company.party.email %}
|
{% if invoice.company.party.contact_mechanisms %}
|
||||||
<ContactDetails>
|
{{ contact(invoice.company.party) }}
|
||||||
{% if invoice.company.party.phone or invoice.company.party.mobile %}
|
|
||||||
<Telephone>{{ (invoice.company.party.phone or invoice.company.party.mobile)[:15] }}</Telephone>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.company.party.fax %}
|
|
||||||
<TeleFax>{{ invoice.company.party.fax[:15] }}</TeleFax>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.company.party.website %}
|
|
||||||
<WebAddress>{{ invoice.company.party.website[:60] }}</WebAddress>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.company.party.email %}
|
|
||||||
<ElectronicMail>{{ invoice.company.party.email[:60] }}</ElectronicMail>
|
|
||||||
{% endif %}
|
|
||||||
{# Optional: not supported
|
|
||||||
<ContactPersons></ContactPersons>
|
|
||||||
<CnoCnae></CnoCnae>
|
|
||||||
<INETownCode></INETownCode>
|
|
||||||
<AdditionalContactDetails></AdditionalContactDetails>
|
|
||||||
#}
|
|
||||||
</ContactDetails>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</LegalEntity>
|
</LegalEntity>
|
||||||
</SellerParty>
|
</SellerParty>
|
||||||
|
@ -101,9 +76,16 @@
|
||||||
</TaxIdentification>
|
</TaxIdentification>
|
||||||
{# Optional. It could be the ID or the code #}
|
{# Optional. It could be the ID or the code #}
|
||||||
{% if invoice.party.code and invoice.party.code | length < 10 %}
|
{% if invoice.party.code and invoice.party.code | length < 10 %}
|
||||||
<PartyIdentification>{{ invoice.party.code }}</PartyIdentification>
|
<PartyIdentification>{{ invoice.party.code|int or invoice.party.id }}</PartyIdentification>
|
||||||
|
{% endif %}
|
||||||
|
{% if invoice.party.oficina_contable or invoice.party.organo_gestor or invoice.party.unidad_tramitadora or invoice.party.organo_proponente %}
|
||||||
|
<AdministrativeCentres>
|
||||||
|
{% if invoice.party.oficina_contable %}{{ administrative_center(invoice.party.oficina_contable, '01', invoice.party) }}{% endif %}
|
||||||
|
{% if invoice.party.organo_gestor %}{{ administrative_center(invoice.party.organo_gestor, '02', invoice.party) }}{% endif %}
|
||||||
|
{% if invoice.party.unidad_tramitadora %}{{ administrative_center(invoice.party.unidad_tramitadora, '03', invoice.party) }}{% endif %}
|
||||||
|
{% if invoice.party.organo_proponente %}{{ administrative_center(invoice.party.organo_proponente, '04', invoice.party) }}{% endif %}
|
||||||
|
</AdministrativeCentres>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# AdministrativeCentres optional: not supported #}
|
|
||||||
{% if invoice.party.facturae_person_type == 'J' %}
|
{% if invoice.party.facturae_person_type == 'J' %}
|
||||||
<LegalEntity>
|
<LegalEntity>
|
||||||
<CorporateName>{{ invoice.party.name and invoice.party.name[:80] or invoice.party.code[:80] }}</CorporateName>
|
<CorporateName>{{ invoice.party.name and invoice.party.name[:80] or invoice.party.code[:80] }}</CorporateName>
|
||||||
|
@ -111,43 +93,9 @@
|
||||||
<TradeName>{{ invoice.party.trade_name[:40] }}</TradeName>
|
<TradeName>{{ invoice.party.trade_name[:40] }}</TradeName>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# RegistrationData optional: not supported #}
|
{# RegistrationData optional: not supported #}
|
||||||
{% if invoice.invoice_address.country.code == 'ES' %}
|
{{ address(invoice.invoice_address) }}
|
||||||
<AddressInSpain>
|
{% if invoice.party.contact_mechanisms %}
|
||||||
<Address>{{ invoice.invoice_address.street[:80] }}</Address>
|
{{ contact(invoice.party) }}
|
||||||
<PostCode>{{ invoice.invoice_address.zip[:5] }}</PostCode>
|
|
||||||
<Town>{{ invoice.invoice_address.city[:50] }}</Town>
|
|
||||||
<Province>{{ invoice.invoice_address.subdivision.name[:20] }}</Province>
|
|
||||||
<CountryCode>{{ invoice.invoice_address.country.code3 }}</CountryCode>
|
|
||||||
</AddressInSpain>
|
|
||||||
{% else %}
|
|
||||||
<OverseasAddress>
|
|
||||||
<Address>{{ invoice.invoice_address.street[:80] }}</Address>
|
|
||||||
<PostCodeAndTown>{{ (', '.join(invoice.invoice_address.zip, invoice.invoice_address.city))[:50] }}</PostCode>
|
|
||||||
<Province>{{ invoice.invoice_address.subdivision.name[:20] }}</Province>
|
|
||||||
<CountryCode>{{ invoice.invoice_address.country.code3 }}</CountryCode>
|
|
||||||
</OverseasAddress>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.party.phone or invoice.party.mobile or invoice.party.fax or invoice.party.website or invoice.party.email %}
|
|
||||||
<ContactDetails>
|
|
||||||
{% if invoice.party.phone or invoice.party.mobile %}
|
|
||||||
<Telephone>{{ (invoice.party.phone or invoice.party.mobile)[:15] }}</Telephone>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.party.fax %}
|
|
||||||
<TeleFax>{{ invoice.party.fax[:15] }}</TeleFax>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.party.website %}
|
|
||||||
<WebAddress>{{ invoice.party.website[:60] }}</WebAddress>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.party.email %}
|
|
||||||
<ElectronicMail>{{ invoice.party.email[:60] }}</ElectronicMail>
|
|
||||||
{% endif %}
|
|
||||||
{# Optional: not supported
|
|
||||||
<ContactPersons></ContactPersons>
|
|
||||||
<CnoCnae></CnoCnae>
|
|
||||||
<INETownCode></INETownCode>
|
|
||||||
<AdditionalContactDetails></AdditionalContactDetails>
|
|
||||||
#}
|
|
||||||
</ContactDetails>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</LegalEntity>
|
</LegalEntity>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -158,43 +106,9 @@
|
||||||
<SecondSurname>{{ invoice.party.name and invoice.party.name.split(' ', 2)[2][:40] }}</SecondSurname>
|
<SecondSurname>{{ invoice.party.name and invoice.party.name.split(' ', 2)[2][:40] }}</SecondSurname>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# RegistrationData optional: not supported #}
|
{# RegistrationData optional: not supported #}
|
||||||
{% if invoice.invoice_address.country.code == 'ES' %}
|
{{ address(invoice.invoice_address) }}
|
||||||
<AddressInSpain>
|
{% if invoice.party.contact_mechanisms %}
|
||||||
<Address>{{ invoice.invoice_address.street[:80] }}</Address>
|
{{ contact(invoice.party) }}
|
||||||
<PostCode>{{ invoice.invoice_address.zip[:5] }}</PostCode>
|
|
||||||
<Town>{{ invoice.invoice_address.city[:50] }}</Town>
|
|
||||||
<Province>{{ invoice.invoice_address.subdivision.name[:20] }}</Province>
|
|
||||||
<CountryCode>{{ invoice.invoice_address.country.code3 }}</CountryCode>
|
|
||||||
</AddressInSpain>
|
|
||||||
{% else %}
|
|
||||||
<OverseasAddress>
|
|
||||||
<Address>{{ invoice.invoice_address.street[:80] }}</Address>
|
|
||||||
<PostCodeAndTown>{{ (', '.join(invoice.invoice_address.zip, invoice.invoice_address.city))[:50] }}</PostCode>
|
|
||||||
<Province>{{ invoice.invoice_address.subdivision.name[:20] }}</Province>
|
|
||||||
<CountryCode>{{ invoice.invoice_address.country.code3 }}</CountryCode>
|
|
||||||
</OverseasAddress>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.party.phone or invoice.party.mobile or invoice.party.fax or invoice.party.website or invoice.party.email %}
|
|
||||||
<ContactDetails>
|
|
||||||
{% if invoice.party.phone or invoice.party.mobile %}
|
|
||||||
<Telephone>{{ (invoice.party.phone or invoice.party.mobile)[:15] }}</Telephone>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.party.fax %}
|
|
||||||
<TeleFax>{{ invoice.party.fax[:15] }}</TeleFax>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.party.website %}
|
|
||||||
<WebAddress>{{ invoice.party.website[:60] }}</WebAddress>
|
|
||||||
{% endif %}
|
|
||||||
{% if invoice.party.email %}
|
|
||||||
<ElectronicMail>{{ invoice.party.email[:60] }}</ElectronicMail>
|
|
||||||
{% endif %}
|
|
||||||
{# Optional: not supported
|
|
||||||
<ContactPersons></ContactPersons>
|
|
||||||
<CnoCnae></CnoCnae>
|
|
||||||
<INETownCode></INETownCode>
|
|
||||||
<AdditionalContactDetails></AdditionalContactDetails>
|
|
||||||
#}
|
|
||||||
</ContactDetails>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</Individual>
|
</Individual>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
{% macro administrative_center(centre_code, role_type_code, party) %}
|
||||||
|
<AdministrativeCentre>
|
||||||
|
<CentreCode>{{ centre_code }}</CentreCode>
|
||||||
|
<RoleTypeCode>{{ role_type_code }}</RoleTypeCode>
|
||||||
|
<Name>{% if party.facturae_person_type == 'J' %}{{ party.name and party.name[:40] }}{% else %}{{ party.name and party.name.split(' ', 2)[0][:40] or party.code[:40] }}{% endif %}</Name>
|
||||||
|
{% if party.facturae_person_type == 'F' %}
|
||||||
|
<FirstSurname>{{ party.name and party.name.split(' ', 2)[1][:40] }}</FirstSurname>
|
||||||
|
{% endif %}
|
||||||
|
{% if party.facturae_person_type == 'F' and party.name.split(' ') | length > 2 %}
|
||||||
|
<SecondSurname>{{ party.name and party.name.split(' ', 2)[2][:40] }}</SecondSurname>
|
||||||
|
{% endif %}
|
||||||
|
{% if party.addresses %}{{ address(party.addresses[0]) }}{% endif %}
|
||||||
|
{% if party.contact_mechanisms %}{{ contact(party) }}{% endif %}
|
||||||
|
<PhysicalGLN/>
|
||||||
|
<LogicalOperationalPoint/>
|
||||||
|
<CentreDescription>{{ party.name and party.name.split(' ', 2)[0][:40] or party.code[:40] }}</CentreDescription>
|
||||||
|
</AdministrativeCentre>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro address(address) %}
|
||||||
|
{% if address.country and address.country.code == 'ES' %}
|
||||||
|
<AddressInSpain>
|
||||||
|
<Address>{{ address.street[:80] }}</Address>
|
||||||
|
<PostCode>{{ address.zip[:5] }}</PostCode>
|
||||||
|
<Town>{{ address.city[:50] }}</Town>
|
||||||
|
<Province>{{ address.subdivision.name[:20] }}</Province>
|
||||||
|
<CountryCode>{{ address.country.code3 }}</CountryCode>
|
||||||
|
</AddressInSpain>
|
||||||
|
{% else %}
|
||||||
|
<OverseasAddress>
|
||||||
|
<Address>{{ address.street[:80] }}</Address>
|
||||||
|
<PostCodeAndTown>{{ (', '.join(address.zip, address.city))[:50] }}</PostCode>
|
||||||
|
<Province>{{ address.subdivision.name[:20] }}</Province>
|
||||||
|
<CountryCode>{{ address.country.code3 }}</CountryCode>
|
||||||
|
</OverseasAddress>
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro contact(party) %}
|
||||||
|
<ContactDetails>
|
||||||
|
{% if party.phone or party.mobile %}
|
||||||
|
<Telephone>{{ (party.phone or party.mobile)[:15] }}</Telephone>
|
||||||
|
{% endif %}
|
||||||
|
{% if party.fax %}
|
||||||
|
<TeleFax>{{ party.fax[:15] }}</TeleFax>
|
||||||
|
{% endif %}
|
||||||
|
{% if party.website %}
|
||||||
|
<WebAddress>{{ party.website[:60] }}</WebAddress>
|
||||||
|
{% endif %}
|
||||||
|
{% if party.email %}
|
||||||
|
<ElectronicMail>{{ party.email[:60] }}</ElectronicMail>
|
||||||
|
{% endif %}
|
||||||
|
{# Optional: not supported
|
||||||
|
<ContactPersons></ContactPersons>
|
||||||
|
<CnoCnae></CnoCnae>
|
||||||
|
<INETownCode></INETownCode>
|
||||||
|
<AdditionalContactDetails></AdditionalContactDetails>
|
||||||
|
#}
|
||||||
|
</ContactDetails>
|
||||||
|
{% endmacro %}
|
|
@ -8,6 +8,14 @@
|
||||||
<field name="facturae_person_type"/>
|
<field name="facturae_person_type"/>
|
||||||
<label name="facturae_residence_type"/>
|
<label name="facturae_residence_type"/>
|
||||||
<field name="facturae_residence_type"/>
|
<field name="facturae_residence_type"/>
|
||||||
|
<label name="oficina_contable"/>
|
||||||
|
<field name="oficina_contable"/>
|
||||||
|
<label name="organo_gestor"/>
|
||||||
|
<field name="organo_gestor"/>
|
||||||
|
<label name="unidad_tramitadora"/>
|
||||||
|
<field name="unidad_tramitadora"/>
|
||||||
|
<label name="organo_proponente"/>
|
||||||
|
<field name="organo_proponente"/>
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
|
|
Loading…
Reference in New Issue