first commit
This commit is contained in:
123
modules/edocument_ubl/template/2/CreditNote.xml
Normal file
123
modules/edocument_ubl/template/2/CreditNote.xml
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<CreditNote
|
||||
xmlns="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2"
|
||||
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
|
||||
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xmlns:py="http://genshi.edgewall.org/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<xi:include href="base.xml"/>
|
||||
<cbc:UBLVersionID py:if="not (specification or '').startswith('peppol')">2.4</cbc:UBLVersionID>
|
||||
<py:if test="specification == 'peppol-bis-3'">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
|
||||
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
|
||||
</py:if>
|
||||
<cbc:ID>${this.invoice.number}</cbc:ID>
|
||||
<cbc:IssueDate>${this.invoice.invoice_date}</cbc:IssueDate>
|
||||
<cbc:DueDate>${max(l.maturity_date for l in this.invoice.lines_to_pay if l.maturity_date)}</cbc:DueDate>
|
||||
<cbc:CreditNoteTypeCode>${this.type_code}</cbc:CreditNoteTypeCode>
|
||||
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
|
||||
<cbc:BuyerReference py:if="this.invoice.reference">${this.invoice.reference}</cbc:BuyerReference>
|
||||
<cac:OrderReference>
|
||||
<cbc:ID>${this.sale_reference or 'NA'}</cbc:ID>
|
||||
<cbc:SalesOrderID py:if="this.sale_number">${this.sale_number}</cbc:SalesOrderID>
|
||||
</cac:OrderReference>
|
||||
<cac:AdditionalDocumentReference py:for="document in this.additional_documents">
|
||||
<cbc:ID>${document['id']}</cbc:ID>
|
||||
<cbc:DocumentTypeCode py:if="document.get('code')">${document['code']}</cbc:DocumentTypeCode>
|
||||
<cbc:DocumentDescription py:if="document.get('description')">${document['description']}</cbc:DocumentDescription>
|
||||
<cac:Attachment py:if="document.get('code') != '130'">
|
||||
<py:choose test="document['type']">
|
||||
<py:when test="'binary'">
|
||||
<cbc:EmbeddedDocumentBinaryObject py:attrs="{'mimeCode': document['mimetype'], 'filename': document.get('filename')}">${document['binary']}</cbc:EmbeddedDocumentBinaryObject>
|
||||
</py:when>
|
||||
<py:when test="'text'">
|
||||
<cbc:EmbeddedDocument>${document['text']}</cbc:EmbeddedDocument>
|
||||
</py:when>
|
||||
<py:when test="'reference'">
|
||||
<cac:ExternalReference>
|
||||
<cbc:URI>${document['reference']}</cbc:URI>
|
||||
<cbc:FileName py:if="document.get('filename')">${document['filename']}</cbc:FileName>
|
||||
</cac:ExternalReference>
|
||||
</py:when>
|
||||
</py:choose>
|
||||
</cac:Attachment>
|
||||
</cac:AdditionalDocumentReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
${Party(this.accounting_supplier_party, this.accounting_supplier_address, this.accounting_supplier_tax_identifier, specification=specification)}
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
${Party(this.accounting_customer_party, this.accounting_customer_address, this.accounting_customer_tax_identifier, identifications=[this.accounting_customer_party.identifier_iso6523] if (specification or '').startswith('peppol') else None, specification=specification)}
|
||||
</cac:AccountingCustomerParty>
|
||||
<py:choose test="(specification or '').startswith('peppol')">
|
||||
<py:when test="True">
|
||||
<cac:PaymentTerms py:if="this.invoice.payment_term and this.invoice.payment_term.description">
|
||||
<cbc:Note>${this.invoice.payment_term.description}</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
</py:when>
|
||||
<py:otherwise>
|
||||
<cac:PaymentTerms py:for="line in this.invoice.lines_to_pay">
|
||||
<cbc:Note py:if="this.invoice.payment_term and this.invoice.payment_term.description">${this.invoice.payment_term.description}</cbc:Note>
|
||||
<cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${line.amount}</cbc:Amount>
|
||||
<cbc:PaymentDueDate>${line.maturity_date}</cbc:PaymentDueDate>
|
||||
</cac:PaymentTerms>
|
||||
</py:otherwise>
|
||||
</py:choose>
|
||||
<cac:TaxTotal py:for="group, lines, amount in this.taxes">
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-amount}</cbc:TaxAmount>
|
||||
<cac:TaxSubtotal py:for="line in lines">
|
||||
<cbc:TaxableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-line.base}</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-line.amount}</cbc:TaxAmount>
|
||||
<cbc:Percent py:if="line.tax.type == 'percentage' and not (specification or '').startswith('peppol')">${format((line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID py:if="line.tax.unece_category_code">${line.tax.unece_category_code}</cbc:ID>
|
||||
<cbc:Percent py:if="line.tax.type == 'percentage'">${format((line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
|
||||
<cbc:TaxExemptionReason py:if="line.tax.legal_notice">${line.tax.legal_notice}</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme py:if="line.tax.unece_code">
|
||||
<cbc:ID>${line.tax.unece_code}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</cac:TaxTotal>
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-this.invoice.untaxed_amount}</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-this.invoice.untaxed_amount}</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-(this.invoice.untaxed_amount + this.invoice.tax_amount)}</cbc:TaxInclusiveAmount>
|
||||
<py:if test="this.invoice.total_amount != (this.invoice.untaxed_amount + this.invoice.tax_amount)">
|
||||
<cbc:PayableRoundingAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-(this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount)}</cbc:PayableRoundingAmount>
|
||||
</py:if>
|
||||
<cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-this.invoice.total_amount}</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
<cac:CreditNoteLine py:for="line_id, line in enumerate(this.lines, 1)">
|
||||
<cbc:ID>${line_id}</cbc:ID>
|
||||
<cbc:CreditedQuantity py:attrs="{'unitCode': line.unit.unece_code if line.unit and line.unit.unece_code else 'ZZ'}">${format(-Decimal(str(line.quantity)), 'f')}</cbc:CreditedQuantity>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-line.amount}</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Description py:if="line.description">${line.description}</cbc:Description>
|
||||
<cbc:Name>${line.product_name or line.summary}</cbc:Name>
|
||||
<py:if test="line.product">
|
||||
<cac:SellersItemIdentification py:if="line.product.code">
|
||||
<cbc:ID>${line.product.code}</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<py:with vars="gtin=line.product.identifier_get(['ean', 'isbn', 'ismn'])">
|
||||
<cac:StandardItemIdentification py:if="gtin">
|
||||
<cbc:ID schemeID="0160">${gtin}</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
</py:with>
|
||||
</py:if>
|
||||
<cac:ClassifiedTaxCategory py:for="tax_line in line.invoice_taxes">
|
||||
<cbc:ID py:if="tax_line.tax.unece_category_code">${tax_line.tax.unece_category_code}</cbc:ID>
|
||||
<cbc:Percent py:if="tax_line.tax.type == 'percentage'">${format((tax_line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
|
||||
<cbc:TaxExemptionReason py:if="tax_line.tax.legal_notice">${tax_line.tax.legal_notice}</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme py:if="tax_line.tax.unece_code">
|
||||
<cbc:ID>${tax_line.tax.unece_code}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.unit_price}</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:CreditNoteLine>
|
||||
</CreditNote>
|
||||
123
modules/edocument_ubl/template/2/Invoice.xml
Normal file
123
modules/edocument_ubl/template/2/Invoice.xml
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<Invoice
|
||||
xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
|
||||
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
|
||||
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xmlns:py="http://genshi.edgewall.org/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<xi:include href="base.xml"/>
|
||||
<cbc:UBLVersionID py:if="not (specification or '').startswith('peppol')">2.4</cbc:UBLVersionID>
|
||||
<py:if test="specification == 'peppol-bis-3'">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
|
||||
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
|
||||
</py:if>
|
||||
<cbc:ID>${this.invoice.number}</cbc:ID>
|
||||
<cbc:IssueDate>${this.invoice.invoice_date}</cbc:IssueDate>
|
||||
<cbc:DueDate>${min(l.maturity_date for l in this.invoice.lines_to_pay if l.maturity_date)}</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>${this.type_code}</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
|
||||
<cbc:BuyerReference py:if="this.invoice.reference">${this.invoice.reference}</cbc:BuyerReference>
|
||||
<cac:OrderReference>
|
||||
<cbc:ID>${this.sale_reference or 'NA'}</cbc:ID>
|
||||
<cbc:SalesOrderID py:if="this.sale_number">${this.sale_number}</cbc:SalesOrderID>
|
||||
</cac:OrderReference>
|
||||
<cac:AdditionalDocumentReference py:for="document in this.additional_documents">
|
||||
<cbc:ID>${document['id']}</cbc:ID>
|
||||
<cbc:DocumentTypeCode py:if="document.get('code')">${document['code']}</cbc:DocumentTypeCode>
|
||||
<cbc:DocumentDescription py:if="document.get('description')">${document['description']}</cbc:DocumentDescription>
|
||||
<cac:Attachment py:if="document.get('code') != '130'">
|
||||
<py:choose test="document['type']">
|
||||
<py:when test="'binary'">
|
||||
<cbc:EmbeddedDocumentBinaryObject py:attrs="{'mimeCode': document['mimetype'], 'filename': document.get('filename')}">${document['binary']}</cbc:EmbeddedDocumentBinaryObject>
|
||||
</py:when>
|
||||
<py:when test="'text'">
|
||||
<cbc:EmbeddedDocument>${document['text']}</cbc:EmbeddedDocument>
|
||||
</py:when>
|
||||
<py:when test="'reference'">
|
||||
<cac:ExternalReference>
|
||||
<cbc:URI>${document['reference']}</cbc:URI>
|
||||
<cbc:FileName py:if="document.get('filename')">${document['filename']}</cbc:FileName>
|
||||
</cac:ExternalReference>
|
||||
</py:when>
|
||||
</py:choose>
|
||||
</cac:Attachment>
|
||||
</cac:AdditionalDocumentReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
${Party(this.accounting_supplier_party, this.accounting_supplier_address, this.accounting_supplier_tax_identifier, specification=specification)}
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
${Party(this.accounting_customer_party, this.accounting_customer_address, this.accounting_customer_tax_identifier, identifications=[this.accounting_customer_party.identifier_iso6523] if (specification or '').startswith('peppol') else None, specification=specification)}
|
||||
</cac:AccountingCustomerParty>
|
||||
<py:choose test="(specification or '').startswith('peppol')">
|
||||
<py:when test="True">
|
||||
<cac:PaymentTerms py:if="this.invoice.payment_term and this.invoice.payment_term.description">
|
||||
<cbc:Note>${this.invoice.payment_term.description}</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
</py:when>
|
||||
<py:otherwise>
|
||||
<cac:PaymentTerms py:for="line in this.invoice.lines_to_pay">
|
||||
<cbc:Note py:if="this.invoice.payment_term and this.invoice.payment_term.description">${this.invoice.payment_term.description}</cbc:Note>
|
||||
<cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${line.amount}</cbc:Amount>
|
||||
<cbc:PaymentDueDate>${line.maturity_date}</cbc:PaymentDueDate>
|
||||
</cac:PaymentTerms>
|
||||
</py:otherwise>
|
||||
</py:choose>
|
||||
<cac:TaxTotal py:for="group, lines, amount in this.taxes">
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${amount}</cbc:TaxAmount>
|
||||
<cac:TaxSubtotal py:for="line in lines">
|
||||
<cbc:TaxableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.base}</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.amount}</cbc:TaxAmount>
|
||||
<cbc:Percent py:if="line.tax.type == 'percentage' and not (specification or '').startswith('peppol')">${format((line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID py:if="line.tax.unece_category_code">${line.tax.unece_category_code}</cbc:ID>
|
||||
<cbc:Percent py:if="line.tax.type == 'percentage'">${format((line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
|
||||
<cbc:TaxExemptionReason py:if="line.tax.legal_notice">${line.tax.legal_notice}</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme py:if="line.tax.unece_code">
|
||||
<cbc:ID>${line.tax.unece_code}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</cac:TaxTotal>
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.untaxed_amount}</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.untaxed_amount}</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.untaxed_amount + this.invoice.tax_amount}</cbc:TaxInclusiveAmount>
|
||||
<py:if test="this.invoice.total_amount != (this.invoice.untaxed_amount + this.invoice.tax_amount)">
|
||||
<cbc:PayableRoundingAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount}</cbc:PayableRoundingAmount>
|
||||
</py:if>
|
||||
<cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.total_amount}</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
<cac:InvoiceLine py:for="line_id, line in enumerate(this.lines, 1)">
|
||||
<cbc:ID>${line_id}</cbc:ID>
|
||||
<cbc:InvoicedQuantity py:attrs="{'unitCode': line.unit.unece_code if line.unit and line.unit.unece_code else 'ZZ'}">${format(Decimal(str(line.quantity)), 'f')}</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.amount}</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Description py:if="line.description">${line.description}</cbc:Description>
|
||||
<cbc:Name>${line.product_name or line.summary}</cbc:Name>
|
||||
<py:if test="line.product">
|
||||
<cac:SellersItemIdentification py:if="line.product.code">
|
||||
<cbc:ID>${line.product.code}</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<py:with vars="gtin=line.product.identifier_get(['ean', 'isbn', 'ismn'])">
|
||||
<cac:StandardItemIdentification py:if="gtin">
|
||||
<cbc:ID schemeID="0160">${gtin}</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
</py:with>
|
||||
</py:if>
|
||||
<cac:ClassifiedTaxCategory py:for="tax_line in line.invoice_taxes">
|
||||
<cbc:ID py:if="tax_line.tax.unece_category_code">${tax_line.tax.unece_category_code}</cbc:ID>
|
||||
<cbc:Percent py:if="tax_line.tax.type == 'percentage'">${format((tax_line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
|
||||
<cbc:TaxExemptionReason py:if="tax_line.tax.legal_notice">${tax_line.tax.legal_notice}</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme py:if="tax_line.tax.unece_code">
|
||||
<cbc:ID>${tax_line.tax.unece_code}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.unit_price}</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
||||
84
modules/edocument_ubl/template/2/base.xml
Normal file
84
modules/edocument_ubl/template/2/base.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<py:strip xmlns:py="http://genshi.edgewall.org/"
|
||||
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
|
||||
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
|
||||
<py:def function="Party(party, address=None, tax_identifier=None, identifications=None, specification='')">
|
||||
<cac:Party>
|
||||
<py:with vars="identifier = party.identifier_eas">
|
||||
<py:if test="identifier">
|
||||
<cbc:EndpointID py:attrs="{'schemeID': identifier.eas_code}">${identifier.eas}</cbc:EndpointID>
|
||||
</py:if>
|
||||
</py:with>
|
||||
<py:for each="identifier in identifications or party.identifiers">
|
||||
<cac:PartyIdentification py:if="identifier and identifier.iso_6523">
|
||||
<cbc:ID py:attrs="{'schemeID': identifier.iso_6523}">${identifier.code}</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
</py:for>
|
||||
<cac:PostalAddress py:if="address">${Address(address, specification=specification)}</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme py:if="tax_identifier and tax_identifier.unece_code">
|
||||
<py:choose>
|
||||
<py:when test="tax_identifier.vatin">
|
||||
<cbc:CompanyID>${tax_identifier.vatin}</cbc:CompanyID>
|
||||
</py:when>
|
||||
<py:otherwise>
|
||||
<cbc:CompanyID py:attrs="{'schemeID': tax_identifier.iso_6523}">${tax_identifier.code}</cbc:CompanyID>
|
||||
</py:otherwise>
|
||||
</py:choose>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>${tax_identifier.unece_code}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
<cbc:RegistrationName>${party.name}</cbc:RegistrationName>
|
||||
<py:with vars="identifier = party.identifier_iso6523">
|
||||
<py:if test="identifier">
|
||||
<cbc:CompanyID py:attrs="{'schemeID': identifier.iso_6523}">${identifier.code}</cbc:CompanyID>
|
||||
</py:if>
|
||||
</py:with>
|
||||
</cac:PartyLegalEntity>
|
||||
</cac:Party>
|
||||
</py:def>
|
||||
<py:def function="Address(address, specification='')">
|
||||
<py:choose>
|
||||
<py:when test="(specification or '').startswith('peppol')">
|
||||
<py:with vars="streets = (address.street or '').splitlines()">
|
||||
<cbc:StreetName py:if="len(streets) >= 1">${streets[0]}</cbc:StreetName>
|
||||
<cbc:AdditionalStreetName py:if="len(streets) >= 2">${streets[1]}</cbc:AdditionalStreetName>
|
||||
<cbc:CityName py:if="address.city">${address.city}</cbc:CityName>
|
||||
<cbc:PostalZone py:if="address.postal_code">${address.postal_code}</cbc:PostalZone>
|
||||
<cbc:CountrySubentity py:if="address.subdivision">${address.subdivision.name}</cbc:CountrySubentity>
|
||||
<cac:AddressLine py:if="len(streets) >= 3">
|
||||
<cbc:Line>
|
||||
${streets[2]}
|
||||
</cbc:Line>
|
||||
</cac:AddressLine>
|
||||
</py:with>
|
||||
</py:when>
|
||||
<py:otherwise>
|
||||
<cbc:Postbox py:if="address.post_box">${address.post_box}</cbc:Postbox>
|
||||
<cbc:Floor py:if="address.floor_number">${address.floor_number}</cbc:Floor>
|
||||
<cbc:Room py:if="address.room_number">${address.room_number}</cbc:Room>
|
||||
<cbc:StreetName py:if="address.street_name">${address.street_name}</cbc:StreetName>
|
||||
<cbc:BuildingName py:if="address.building_name">${address.building_name}</cbc:BuildingName>
|
||||
<cbc:BuildingNumber py:if="address.building_number">${address.building_number}</cbc:BuildingNumber>
|
||||
<cbc:CityName py:if="address.city">${address.city}</cbc:CityName>
|
||||
<cbc:PostalZone py:if="address.postal_code">${address.postal_code}</cbc:PostalZone>
|
||||
<cbc:CountrySubentity py:if="address.subdivision">${address.subdivision.name}</cbc:CountrySubentity>
|
||||
<cbc:CountrySubentityCode py:if="address.subdivision">${address.subdivision.code}</cbc:CountrySubentityCode>
|
||||
<py:if test="address.street_unstructured">
|
||||
<cac:AddressLine py:for="line in address.street_unstructured.splitlines()">
|
||||
<cbc:Line>
|
||||
${line}
|
||||
</cbc:Line>
|
||||
</cac:AddressLine>
|
||||
</py:if>
|
||||
</py:otherwise>
|
||||
</py:choose>
|
||||
<cac:Country py:if="address.country">
|
||||
<cbc:IdentificationCode>${address.country.code}</cbc:IdentificationCode>
|
||||
<cbc:Name py:if="not (specification or '').startswith('peppol')">${address.country.name}</cbc:Name>
|
||||
</cac:Country>
|
||||
</py:def>
|
||||
</py:strip>
|
||||
Reference in New Issue
Block a user