trytond-account_invoice_fac.../template_facturae_macros.xml

75 lines
3.6 KiB
XML
Raw Permalink Normal View History

{% macro administrative_center(centre_code, role_type_code, person_type, addrs) %}
2018-05-18 09:28:25 +02:00
<AdministrativeCentre>
<CentreCode>{{ centre_code }}</CentreCode>
<RoleTypeCode>{{ role_type_code }}</RoleTypeCode>
<Name>{% if person_type == 'J' %}{{ addrs.party.name and addrs.party.name[:40] }}{% else %}{{ addrs.party.name and addrs.party.name.split(' ', 2)[0][:40] or addrs.party.code[:40] }}{% endif %}</Name>
{% if person_type == 'F' %}
<FirstSurname>{{ addrs.party.name and addrs.party.name.split(' ', 2)[1][:40] }}</FirstSurname>
2018-05-18 09:28:25 +02:00
{% endif %}
{% if person_type == 'F' and addrs.party.name.split(' ') | length > 2 %}
<SecondSurname>{{ addrs.party.name and addrs.party.name.split(' ', 2)[2][:40] }}</SecondSurname>
2018-05-18 09:28:25 +02:00
{% endif %}
{% if addrs %}{{ address(addrs) }}{% endif %}
{% if addrs.party.contact_mechanisms %}{{ contact(addrs.party) }}{% endif %}
2018-05-18 09:28:25 +02:00
<PhysicalGLN/>
<LogicalOperationalPoint/>
<CentreDescription>{{ addrs.party.name and addrs.party.name.split(' ', 2)[0][:40] or addrs.party.code[:40] }}</CentreDescription>
2018-05-18 09:28:25 +02:00
</AdministrativeCentre>
{% endmacro %}
{% macro address(address) %}
{% if address.country and address.country.code == 'ES' %}
<AddressInSpain>
<Address>{{ address.street[:80] }}</Address>
<PostCode>{{ address.postal_code[:5] }}</PostCode>
2018-05-18 09:28:25 +02:00
<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.postal_code, address.city]))[:50] }}</PostCodeAndTown>
2018-05-18 09:28:25 +02:00
<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 %}
{% macro registration_data(company) %}
{% if company.registration_data_location %}
<RegistrationData>
<Book>{{ company.registration_data_book and company.registration_data_book[:20] or '0' }}</Book>
<RegisterOfCompaniesLocation>{{ company.registration_data_location[:20] }}</RegisterOfCompaniesLocation>
<Sheet>{{ company.registration_data_sheet[:20] }}</Sheet>
<Folio>{{ company.registration_data_folio[:20] }}</Folio>
<Section>{{ company.registration_data_section[:20] }}</Section>
<Volume>{{ company.registration_data_volume[:20] }}</Volume>
<AdditionalRegistrationData>{{ company.registration_data_additional[:20] }}</AdditionalRegistrationData>
</RegistrationData>
{% endif %}
{% endmacro %}