export: add xrechnung 2.3 + 3.0 + tests against xsd
This commit is contained in:
parent
82c70c68d5
commit
5b72056598
7 changed files with 762 additions and 10 deletions
|
@ -123,7 +123,7 @@ class Invoice(Invoice):
|
|||
def _get_template(self, version):
|
||||
""" load our own template if 'version' is ours
|
||||
"""
|
||||
if version == 'XRechnung-2.2':
|
||||
if version in ['XRechnung-2.2', 'XRechnung-2.3', 'XRechnung-3.0']:
|
||||
loader = genshi.template.TemplateLoader(
|
||||
os.path.join(os.path.dirname(__file__), 'template'),
|
||||
auto_reload=True)
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.1</cbc:CustomizationID>
|
||||
<cbc:ID>${this.invoice.number}</cbc:ID>
|
||||
<cbc:IssueDate>${this.invoice.invoice_date.isoformat()}</cbc:IssueDate>
|
||||
<cbc:DueDate>${(getattr(this.invoice, 'payment_term_date', None) or this.invoice.invoice_date).isoformat()}</cbc:DueDate>
|
||||
<cbc:DueDate>${(this.invoice.payment_term_date or this.invoice.invoice_date).isoformat()}</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>${this.type_code}</cbc:InvoiceTypeCode>
|
||||
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
|
||||
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
|
||||
|
|
182
template/XRechnung-2.3/XRechnung_credit.xml
Normal file
182
template/XRechnung-2.3/XRechnung_credit.xml
Normal file
|
@ -0,0 +1,182 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ubl:CreditNote
|
||||
xmlns:ubl="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:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2"
|
||||
xmlns:udt="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2"
|
||||
xmlns:py="http://genshi.edgewall.org/"
|
||||
xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-CreditNote-2.1.xsd">
|
||||
|
||||
<py:def function="PostalAddress(value)">
|
||||
<cbc:StreetName>${', '.join((getattr(value, 'street', None) or '').split('\n'))}</cbc:StreetName>
|
||||
<cbc:CityName>${getattr(value, 'city', None) or ''}</cbc:CityName>
|
||||
<cbc:PostalZone>${getattr(value, 'postal_code', None) or ''}</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>${getattr(getattr(value, 'country', None), 'code', None)}</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyTaxScheme(value)">
|
||||
<cbc:CompanyID>${this.taxident_data(value)['code']}</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>${this.taxident_data(value)['id']}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</py:def>
|
||||
|
||||
<py:def function="Contact(value)">
|
||||
<cbc:Name>${value.name}</cbc:Name>
|
||||
<py:if test="value.phone">
|
||||
<cbc:Telephone>${value.phone}</cbc:Telephone>
|
||||
</py:if>
|
||||
<py:if test="value.email">
|
||||
<cbc:ElectronicMail>${value.email}</cbc:ElectronicMail>
|
||||
</py:if>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyLegalEntity(value, company_id=True)">
|
||||
<cbc:RegistrationName>${value.name}</cbc:RegistrationName>
|
||||
<cbc:CompanyID py:if="company_id">${this.taxident_data(this.seller_trade_tax_identifier)['code']}</cbc:CompanyID>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PayeeFinancialAccount(value)">
|
||||
<py:if test="len(value.bank_accounts)>0">
|
||||
<cbc:ID>${value.bank_accounts[0].numbers[0].number_compact}</cbc:ID>
|
||||
<cbc:Name>${value.name}</cbc:Name>
|
||||
</py:if>
|
||||
</py:def>
|
||||
|
||||
<py:def function="TaxCategory(value, incl_reason=False)">
|
||||
<cbc:ID>${this.tax_category_code(value)}</cbc:ID>
|
||||
<cbc:Percent>${this.tax_rate(value)}</cbc:Percent>
|
||||
<cbc:TaxExemptionReason
|
||||
py:if="(this.tax_category_code(value) in ['E']) and (incl_reason==True)">${value.legal_notice or '-'}</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</py:def>
|
||||
|
||||
<py:def function="TaxSubTotal(value)">
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount py:attrs="{'currencyID': value.currency.code}">${this.negate_amount(value.base)}</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': value.currency.code}">${this.negate_amount(value.amount)}</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
${TaxCategory(value.tax, True)}
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</py:def>
|
||||
|
||||
<py:def function="CreditNoteLine(value)">
|
||||
<cac:CreditNoteLine>
|
||||
<cbc:ID>${value.id}</cbc:ID>
|
||||
<cbc:CreditedQuantity py:attrs="{'unitCode': this.uom_unece_code(value)}">${this.negate_amount(value.quantity)}</cbc:CreditedQuantity>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': value.currency.code}">${this.negate_amount(value.amount)}</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>${value.description or getattr(value.product, 'name', None)}</cbc:Name>
|
||||
<cac:SellersItemIdentification py:if="getattr(value.product, 'code', None)">
|
||||
<cbc:ID>${value.product.code}</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
${TaxCategory(this.invoice_line_tax(value))}
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount py:attrs="{'currencyID': value.currency.code}">${value.unit_price}</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:CreditNoteLine>
|
||||
</py:def>
|
||||
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.3</cbc:CustomizationID>
|
||||
<cbc:ID>${this.invoice.number}</cbc:ID>
|
||||
<cbc:IssueDate>${this.invoice.invoice_date.isoformat()}</cbc:IssueDate>
|
||||
<cbc:CreditNoteTypeCode>${this.type_code}</cbc:CreditNoteTypeCode>
|
||||
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
|
||||
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
|
||||
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
|
||||
<cac:OrderReference py:if="this.invoice.reference">
|
||||
<cbc:ID>${this.invoice.reference}</cbc:ID>
|
||||
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>
|
||||
</cac:OrderReference>
|
||||
<cac:ContractDocumentReference py:if="False">
|
||||
<cbc:ID>vertrags-nr</cbc:ID>
|
||||
</cac:ContractDocumentReference>
|
||||
<cac:ProjectReference py:if="False">
|
||||
<cbc:ID>proj-referenz</cbc:ID>
|
||||
</cac:ProjectReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PostalAddress>
|
||||
${PostalAddress(this.seller_trade_address)}
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
${PartyTaxScheme(this.seller_trade_tax_identifier)}
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
${PartyLegalEntity(this.seller_trade_party)}
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
${Contact(this.seller_trade_party)}
|
||||
</cac:Contact>
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID>${this.buyer_trade_party.code}</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PostalAddress>
|
||||
${PostalAddress(this.buyer_trade_address)}
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
${PartyTaxScheme(this.buyer_trade_tax_identifier)}
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
${PartyLegalEntity(this.buyer_trade_party, False)}
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
${Contact(this.buyer_trade_party)}
|
||||
</cac:Contact>
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
<cac:PaymentMeans>
|
||||
<cbc:PaymentMeansCode>30</cbc:PaymentMeansCode>
|
||||
<cbc:PaymentID>${this.payment_reference}</cbc:PaymentID>
|
||||
<cac:PayeeFinancialAccount>
|
||||
${PayeeFinancialAccount(this.seller_trade_party)}
|
||||
</cac:PayeeFinancialAccount>
|
||||
</cac:PaymentMeans>
|
||||
<cac:PaymentTerms py:if="this.invoice.payment_term is not None">
|
||||
<cbc:Note>${this.invoice.payment_term.rec_name}</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
<cac:AllowanceCharge py:if="False">
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Neukundenrabatt</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">5.00</cbc:Amount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.tax_amount)}</cbc:TaxAmount>
|
||||
<py:for each="taxline in this.invoice.taxes">
|
||||
${TaxSubTotal(taxline)}
|
||||
</py:for>
|
||||
</cac:TaxTotal>
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.untaxed_amount)}</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.untaxed_amount)}</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.total_amount)}</cbc:TaxInclusiveAmount>
|
||||
<cbc:AllowanceTotalAmount py:if="False" py:attrs="{'currencyID': this.invoice.currency.code}">0.00</cbc:AllowanceTotalAmount>
|
||||
<cbc:ChargeTotalAmount py:if="False" py:attrs="{'currencyID': this.invoice.currency.code}">0.00</cbc:ChargeTotalAmount>
|
||||
<cbc:PrepaidAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.prepaid_amount(this.invoice))}</cbc:PrepaidAmount>
|
||||
<cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.amount_to_pay)}</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
<py:for each="line in this.lines">
|
||||
${CreditNoteLine(line)}
|
||||
</py:for>
|
||||
</ubl:CreditNote>
|
183
template/XRechnung-2.3/XRechnung_invoice.xml
Normal file
183
template/XRechnung-2.3/XRechnung_invoice.xml
Normal file
|
@ -0,0 +1,183 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ubl:Invoice
|
||||
xmlns:ubl="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:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2"
|
||||
xmlns:udt="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2"
|
||||
xmlns:py="http://genshi.edgewall.org/"
|
||||
xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd">
|
||||
|
||||
<py:def function="PostalAddress(value)">
|
||||
<cbc:StreetName>${', '.join((getattr(value, 'street', None) or '').split('\n'))}</cbc:StreetName>
|
||||
<cbc:CityName>${getattr(value, 'city', None) or ''}</cbc:CityName>
|
||||
<cbc:PostalZone>${getattr(value, 'postal_code', None) or ''}</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>${getattr(getattr(value, 'country', None), 'code', None)}</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyTaxScheme(value)">
|
||||
<cbc:CompanyID>${this.taxident_data(value)['code']}</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>${this.taxident_data(value)['id']}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</py:def>
|
||||
|
||||
<py:def function="Contact(value)">
|
||||
<cbc:Name>${value.name}</cbc:Name>
|
||||
<py:if test="value.phone">
|
||||
<cbc:Telephone>${value.phone}</cbc:Telephone>
|
||||
</py:if>
|
||||
<py:if test="value.email">
|
||||
<cbc:ElectronicMail>${value.email}</cbc:ElectronicMail>
|
||||
</py:if>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyLegalEntity(value, company_id=True)">
|
||||
<cbc:RegistrationName>${value.name}</cbc:RegistrationName>
|
||||
<cbc:CompanyID py:if="company_id">${this.taxident_data(this.seller_trade_tax_identifier)['code']}</cbc:CompanyID>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PayeeFinancialAccount(value)">
|
||||
<py:if test="len(value.bank_accounts)>0">
|
||||
<cbc:ID>${value.bank_accounts[0].numbers[0].number_compact}</cbc:ID>
|
||||
<cbc:Name>${value.name}</cbc:Name>
|
||||
</py:if>
|
||||
</py:def>
|
||||
|
||||
<py:def function="TaxCategory(value, incl_reason=False)">
|
||||
<cbc:ID>${this.tax_category_code(value)}</cbc:ID>
|
||||
<cbc:Percent>${this.tax_rate(value)}</cbc:Percent>
|
||||
<cbc:TaxExemptionReason
|
||||
py:if="(this.tax_category_code(value) in ['E']) and (incl_reason==True)">${value.legal_notice or '-'}</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</py:def>
|
||||
|
||||
<py:def function="TaxSubTotal(value)">
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount py:attrs="{'currencyID': value.currency.code}">${value.base}</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': value.currency.code}">${value.amount}</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
${TaxCategory(value.tax, True)}
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</py:def>
|
||||
|
||||
<py:def function="InvoiceLine(value)">
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>${value.id}</cbc:ID>
|
||||
<cbc:InvoicedQuantity py:attrs="{'unitCode': this.uom_unece_code(value)}">${value.quantity}</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': value.currency.code}">${value.amount}</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>${value.description or getattr(value.product, 'name', None)}</cbc:Name>
|
||||
<cac:SellersItemIdentification py:if="getattr(value.product, 'code', None)">
|
||||
<cbc:ID>${value.product.code}</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
${TaxCategory(this.invoice_line_tax(value))}
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount py:attrs="{'currencyID': value.currency.code}">${value.unit_price}</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</py:def>
|
||||
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.3</cbc:CustomizationID>
|
||||
<cbc:ID>${this.invoice.number}</cbc:ID>
|
||||
<cbc:IssueDate>${this.invoice.invoice_date.isoformat()}</cbc:IssueDate>
|
||||
<cbc:DueDate>${(this.invoice.payment_term_date or this.invoice.invoice_date).isoformat()}</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>${this.type_code}</cbc:InvoiceTypeCode>
|
||||
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
|
||||
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
|
||||
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
|
||||
<cac:OrderReference py:if="this.invoice.reference">
|
||||
<cbc:ID>${this.invoice.reference}</cbc:ID>
|
||||
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>
|
||||
</cac:OrderReference>
|
||||
<cac:ContractDocumentReference py:if="False">
|
||||
<cbc:ID>vertrags-nr</cbc:ID>
|
||||
</cac:ContractDocumentReference>
|
||||
<cac:ProjectReference py:if="False">
|
||||
<cbc:ID>proj-referenz</cbc:ID>
|
||||
</cac:ProjectReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PostalAddress>
|
||||
${PostalAddress(this.seller_trade_address)}
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
${PartyTaxScheme(this.seller_trade_tax_identifier)}
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
${PartyLegalEntity(this.seller_trade_party)}
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
${Contact(this.seller_trade_party)}
|
||||
</cac:Contact>
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID>${this.buyer_trade_party.code}</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PostalAddress>
|
||||
${PostalAddress(this.buyer_trade_address)}
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
${PartyTaxScheme(this.buyer_trade_tax_identifier)}
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
${PartyLegalEntity(this.buyer_trade_party, False)}
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
${Contact(this.buyer_trade_party)}
|
||||
</cac:Contact>
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
<cac:PaymentMeans>
|
||||
<cbc:PaymentMeansCode>30</cbc:PaymentMeansCode>
|
||||
<cbc:PaymentID>${this.payment_reference}</cbc:PaymentID>
|
||||
<cac:PayeeFinancialAccount>
|
||||
${PayeeFinancialAccount(this.seller_trade_party)}
|
||||
</cac:PayeeFinancialAccount>
|
||||
</cac:PaymentMeans>
|
||||
<cac:PaymentTerms py:if="this.invoice.payment_term is not None">
|
||||
<cbc:Note>${this.invoice.payment_term.rec_name}</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
<cac:AllowanceCharge py:if="False">
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Neukundenrabatt</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">5.00</cbc:Amount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.tax_amount}</cbc:TaxAmount>
|
||||
<py:for each="taxline in this.invoice.taxes">
|
||||
${TaxSubTotal(taxline)}
|
||||
</py:for>
|
||||
</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.total_amount}</cbc:TaxInclusiveAmount>
|
||||
<cbc:AllowanceTotalAmount py:if="False" py:attrs="{'currencyID': this.invoice.currency.code}">0.00</cbc:AllowanceTotalAmount>
|
||||
<cbc:ChargeTotalAmount py:if="False" py:attrs="{'currencyID': this.invoice.currency.code}">0.00</cbc:ChargeTotalAmount>
|
||||
<cbc:PrepaidAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.prepaid_amount(this.invoice)}</cbc:PrepaidAmount>
|
||||
<cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.amount_to_pay}</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
<py:for each="line in this.lines">
|
||||
${InvoiceLine(line)}
|
||||
</py:for>
|
||||
</ubl:Invoice>
|
182
template/XRechnung-3.0/XRechnung_credit.xml
Normal file
182
template/XRechnung-3.0/XRechnung_credit.xml
Normal file
|
@ -0,0 +1,182 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ubl:CreditNote
|
||||
xmlns:ubl="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:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2"
|
||||
xmlns:udt="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2"
|
||||
xmlns:py="http://genshi.edgewall.org/"
|
||||
xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-CreditNote-2.1.xsd">
|
||||
|
||||
<py:def function="PostalAddress(value)">
|
||||
<cbc:StreetName>${', '.join((getattr(value, 'street', None) or '').split('\n'))}</cbc:StreetName>
|
||||
<cbc:CityName>${getattr(value, 'city', None) or ''}</cbc:CityName>
|
||||
<cbc:PostalZone>${getattr(value, 'postal_code', None) or ''}</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>${getattr(getattr(value, 'country', None), 'code', None)}</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyTaxScheme(value)">
|
||||
<cbc:CompanyID>${this.taxident_data(value)['code']}</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>${this.taxident_data(value)['id']}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</py:def>
|
||||
|
||||
<py:def function="Contact(value)">
|
||||
<cbc:Name>${value.name}</cbc:Name>
|
||||
<py:if test="value.phone">
|
||||
<cbc:Telephone>${value.phone}</cbc:Telephone>
|
||||
</py:if>
|
||||
<py:if test="value.email">
|
||||
<cbc:ElectronicMail>${value.email}</cbc:ElectronicMail>
|
||||
</py:if>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyLegalEntity(value, company_id=True)">
|
||||
<cbc:RegistrationName>${value.name}</cbc:RegistrationName>
|
||||
<cbc:CompanyID py:if="company_id">${this.taxident_data(this.seller_trade_tax_identifier)['code']}</cbc:CompanyID>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PayeeFinancialAccount(value)">
|
||||
<py:if test="len(value.bank_accounts)>0">
|
||||
<cbc:ID>${value.bank_accounts[0].numbers[0].number_compact}</cbc:ID>
|
||||
<cbc:Name>${value.name}</cbc:Name>
|
||||
</py:if>
|
||||
</py:def>
|
||||
|
||||
<py:def function="TaxCategory(value, incl_reason=False)">
|
||||
<cbc:ID>${this.tax_category_code(value)}</cbc:ID>
|
||||
<cbc:Percent>${this.tax_rate(value)}</cbc:Percent>
|
||||
<cbc:TaxExemptionReason
|
||||
py:if="(this.tax_category_code(value) in ['E']) and (incl_reason==True)">${value.legal_notice or '-'}</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</py:def>
|
||||
|
||||
<py:def function="TaxSubTotal(value)">
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount py:attrs="{'currencyID': value.currency.code}">${this.negate_amount(value.base)}</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': value.currency.code}">${this.negate_amount(value.amount)}</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
${TaxCategory(value.tax, True)}
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</py:def>
|
||||
|
||||
<py:def function="CreditNoteLine(value)">
|
||||
<cac:CreditNoteLine>
|
||||
<cbc:ID>${value.id}</cbc:ID>
|
||||
<cbc:CreditedQuantity py:attrs="{'unitCode': this.uom_unece_code(value)}">${this.negate_amount(value.quantity)}</cbc:CreditedQuantity>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': value.currency.code}">${this.negate_amount(value.amount)}</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>${value.description or getattr(value.product, 'name', None)}</cbc:Name>
|
||||
<cac:SellersItemIdentification py:if="getattr(value.product, 'code', None)">
|
||||
<cbc:ID>${value.product.code}</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
${TaxCategory(this.invoice_line_tax(value))}
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount py:attrs="{'currencyID': value.currency.code}">${value.unit_price}</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:CreditNoteLine>
|
||||
</py:def>
|
||||
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_3.0</cbc:CustomizationID>
|
||||
<cbc:ID>${this.invoice.number}</cbc:ID>
|
||||
<cbc:IssueDate>${this.invoice.invoice_date.isoformat()}</cbc:IssueDate>
|
||||
<cbc:CreditNoteTypeCode>${this.type_code}</cbc:CreditNoteTypeCode>
|
||||
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
|
||||
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
|
||||
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
|
||||
<cac:OrderReference py:if="this.invoice.reference">
|
||||
<cbc:ID>${this.invoice.reference}</cbc:ID>
|
||||
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>
|
||||
</cac:OrderReference>
|
||||
<cac:ContractDocumentReference py:if="False">
|
||||
<cbc:ID>vertrags-nr</cbc:ID>
|
||||
</cac:ContractDocumentReference>
|
||||
<cac:ProjectReference py:if="False">
|
||||
<cbc:ID>proj-referenz</cbc:ID>
|
||||
</cac:ProjectReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PostalAddress>
|
||||
${PostalAddress(this.seller_trade_address)}
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
${PartyTaxScheme(this.seller_trade_tax_identifier)}
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
${PartyLegalEntity(this.seller_trade_party)}
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
${Contact(this.seller_trade_party)}
|
||||
</cac:Contact>
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID>${this.buyer_trade_party.code}</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PostalAddress>
|
||||
${PostalAddress(this.buyer_trade_address)}
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
${PartyTaxScheme(this.buyer_trade_tax_identifier)}
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
${PartyLegalEntity(this.buyer_trade_party, False)}
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
${Contact(this.buyer_trade_party)}
|
||||
</cac:Contact>
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
<cac:PaymentMeans>
|
||||
<cbc:PaymentMeansCode>30</cbc:PaymentMeansCode>
|
||||
<cbc:PaymentID>${this.payment_reference}</cbc:PaymentID>
|
||||
<cac:PayeeFinancialAccount>
|
||||
${PayeeFinancialAccount(this.seller_trade_party)}
|
||||
</cac:PayeeFinancialAccount>
|
||||
</cac:PaymentMeans>
|
||||
<cac:PaymentTerms py:if="this.invoice.payment_term is not None">
|
||||
<cbc:Note>${this.invoice.payment_term.rec_name}</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
<cac:AllowanceCharge py:if="False">
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Neukundenrabatt</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">5.00</cbc:Amount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.tax_amount)}</cbc:TaxAmount>
|
||||
<py:for each="taxline in this.invoice.taxes">
|
||||
${TaxSubTotal(taxline)}
|
||||
</py:for>
|
||||
</cac:TaxTotal>
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.untaxed_amount)}</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.untaxed_amount)}</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.total_amount)}</cbc:TaxInclusiveAmount>
|
||||
<cbc:AllowanceTotalAmount py:if="False" py:attrs="{'currencyID': this.invoice.currency.code}">0.00</cbc:AllowanceTotalAmount>
|
||||
<cbc:ChargeTotalAmount py:if="False" py:attrs="{'currencyID': this.invoice.currency.code}">0.00</cbc:ChargeTotalAmount>
|
||||
<cbc:PrepaidAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.prepaid_amount(this.invoice))}</cbc:PrepaidAmount>
|
||||
<cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.negate_amount(this.invoice.amount_to_pay)}</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
<py:for each="line in this.lines">
|
||||
${CreditNoteLine(line)}
|
||||
</py:for>
|
||||
</ubl:CreditNote>
|
183
template/XRechnung-3.0/XRechnung_invoice.xml
Normal file
183
template/XRechnung-3.0/XRechnung_invoice.xml
Normal file
|
@ -0,0 +1,183 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ubl:Invoice
|
||||
xmlns:ubl="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:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2"
|
||||
xmlns:udt="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2"
|
||||
xmlns:py="http://genshi.edgewall.org/"
|
||||
xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd">
|
||||
|
||||
<py:def function="PostalAddress(value)">
|
||||
<cbc:StreetName>${', '.join((getattr(value, 'street', None) or '').split('\n'))}</cbc:StreetName>
|
||||
<cbc:CityName>${getattr(value, 'city', None) or ''}</cbc:CityName>
|
||||
<cbc:PostalZone>${getattr(value, 'postal_code', None) or ''}</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>${getattr(getattr(value, 'country', None), 'code', None)}</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyTaxScheme(value)">
|
||||
<cbc:CompanyID>${this.taxident_data(value)['code']}</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>${this.taxident_data(value)['id']}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</py:def>
|
||||
|
||||
<py:def function="Contact(value)">
|
||||
<cbc:Name>${value.name}</cbc:Name>
|
||||
<py:if test="value.phone">
|
||||
<cbc:Telephone>${value.phone}</cbc:Telephone>
|
||||
</py:if>
|
||||
<py:if test="value.email">
|
||||
<cbc:ElectronicMail>${value.email}</cbc:ElectronicMail>
|
||||
</py:if>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyLegalEntity(value, company_id=True)">
|
||||
<cbc:RegistrationName>${value.name}</cbc:RegistrationName>
|
||||
<cbc:CompanyID py:if="company_id">${this.taxident_data(this.seller_trade_tax_identifier)['code']}</cbc:CompanyID>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PayeeFinancialAccount(value)">
|
||||
<py:if test="len(value.bank_accounts)>0">
|
||||
<cbc:ID>${value.bank_accounts[0].numbers[0].number_compact}</cbc:ID>
|
||||
<cbc:Name>${value.name}</cbc:Name>
|
||||
</py:if>
|
||||
</py:def>
|
||||
|
||||
<py:def function="TaxCategory(value, incl_reason=False)">
|
||||
<cbc:ID>${this.tax_category_code(value)}</cbc:ID>
|
||||
<cbc:Percent>${this.tax_rate(value)}</cbc:Percent>
|
||||
<cbc:TaxExemptionReason
|
||||
py:if="(this.tax_category_code(value) in ['E']) and (incl_reason==True)">${value.legal_notice or '-'}</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</py:def>
|
||||
|
||||
<py:def function="TaxSubTotal(value)">
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount py:attrs="{'currencyID': value.currency.code}">${value.base}</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': value.currency.code}">${value.amount}</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
${TaxCategory(value.tax, True)}
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</py:def>
|
||||
|
||||
<py:def function="InvoiceLine(value)">
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>${value.id}</cbc:ID>
|
||||
<cbc:InvoicedQuantity py:attrs="{'unitCode': this.uom_unece_code(value)}">${value.quantity}</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount py:attrs="{'currencyID': value.currency.code}">${value.amount}</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>${value.description or getattr(value.product, 'name', None)}</cbc:Name>
|
||||
<cac:SellersItemIdentification py:if="getattr(value.product, 'code', None)">
|
||||
<cbc:ID>${value.product.code}</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
${TaxCategory(this.invoice_line_tax(value))}
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount py:attrs="{'currencyID': value.currency.code}">${value.unit_price}</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</py:def>
|
||||
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_3.0</cbc:CustomizationID>
|
||||
<cbc:ID>${this.invoice.number}</cbc:ID>
|
||||
<cbc:IssueDate>${this.invoice.invoice_date.isoformat()}</cbc:IssueDate>
|
||||
<cbc:DueDate>${(this.invoice.payment_term_date or this.invoice.invoice_date).isoformat()}</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>${this.type_code}</cbc:InvoiceTypeCode>
|
||||
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
|
||||
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
|
||||
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
|
||||
<cac:OrderReference py:if="this.invoice.reference">
|
||||
<cbc:ID>${this.invoice.reference}</cbc:ID>
|
||||
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>
|
||||
</cac:OrderReference>
|
||||
<cac:ContractDocumentReference py:if="False">
|
||||
<cbc:ID>vertrags-nr</cbc:ID>
|
||||
</cac:ContractDocumentReference>
|
||||
<cac:ProjectReference py:if="False">
|
||||
<cbc:ID>proj-referenz</cbc:ID>
|
||||
</cac:ProjectReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PostalAddress>
|
||||
${PostalAddress(this.seller_trade_address)}
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
${PartyTaxScheme(this.seller_trade_tax_identifier)}
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
${PartyLegalEntity(this.seller_trade_party)}
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
${Contact(this.seller_trade_party)}
|
||||
</cac:Contact>
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID>${this.buyer_trade_party.code}</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PostalAddress>
|
||||
${PostalAddress(this.buyer_trade_address)}
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
${PartyTaxScheme(this.buyer_trade_tax_identifier)}
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
${PartyLegalEntity(this.buyer_trade_party, False)}
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
${Contact(this.buyer_trade_party)}
|
||||
</cac:Contact>
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
<cac:PaymentMeans>
|
||||
<cbc:PaymentMeansCode>30</cbc:PaymentMeansCode>
|
||||
<cbc:PaymentID>${this.payment_reference}</cbc:PaymentID>
|
||||
<cac:PayeeFinancialAccount>
|
||||
${PayeeFinancialAccount(this.seller_trade_party)}
|
||||
</cac:PayeeFinancialAccount>
|
||||
</cac:PaymentMeans>
|
||||
<cac:PaymentTerms py:if="this.invoice.payment_term is not None">
|
||||
<cbc:Note>${this.invoice.payment_term.rec_name}</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
<cac:AllowanceCharge py:if="False">
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Neukundenrabatt</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">5.00</cbc:Amount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.tax_amount}</cbc:TaxAmount>
|
||||
<py:for each="taxline in this.invoice.taxes">
|
||||
${TaxSubTotal(taxline)}
|
||||
</py:for>
|
||||
</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.total_amount}</cbc:TaxInclusiveAmount>
|
||||
<cbc:AllowanceTotalAmount py:if="False" py:attrs="{'currencyID': this.invoice.currency.code}">0.00</cbc:AllowanceTotalAmount>
|
||||
<cbc:ChargeTotalAmount py:if="False" py:attrs="{'currencyID': this.invoice.currency.code}">0.00</cbc:ChargeTotalAmount>
|
||||
<cbc:PrepaidAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.prepaid_amount(this.invoice)}</cbc:PrepaidAmount>
|
||||
<cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.amount_to_pay}</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
<py:for each="line in this.lines">
|
||||
${InvoiceLine(line)}
|
||||
</py:for>
|
||||
</ubl:Invoice>
|
|
@ -3,11 +3,14 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the
|
||||
# full copyright notices and license terms.
|
||||
|
||||
from lxml import etree
|
||||
import os
|
||||
from unittest.mock import Mock
|
||||
from decimal import Decimal
|
||||
from datetime import date
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.modules.edocument_uncefact.tests.test_module import get_invoice
|
||||
from unittest.mock import Mock
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
class EdocTestCase(ModuleTestCase):
|
||||
|
@ -27,6 +30,7 @@ class EdocTestCase(ModuleTestCase):
|
|||
BankNumber = pool.get('bank.account.number')
|
||||
|
||||
invoice = get_invoice()
|
||||
invoice.payment_term_date = date.today()
|
||||
invoice.party.get_xrechnung_route_id = Mock(
|
||||
return_value='xrechn-route-id-123')
|
||||
invoice.company.party.bank_accounts = [
|
||||
|
@ -48,9 +52,16 @@ class EdocTestCase(ModuleTestCase):
|
|||
]
|
||||
|
||||
template = Template(invoice)
|
||||
invoice_string = template.render('XRechnung-2.2')
|
||||
with open('xrechnung-test-invoice.xml', 'wt') as fhdl:
|
||||
fhdl.write(invoice_string.decode('utf8'))
|
||||
|
||||
schema_file = os.path.join(
|
||||
os.path.dirname(__file__), 'os-UBL-2.1',
|
||||
'xsd', 'maindoc', 'UBL-Invoice-2.1.xsd')
|
||||
|
||||
for x in ['XRechnung-2.2', 'XRechnung-2.3', 'XRechnung-3.0']:
|
||||
invoice_string = template.render(x)
|
||||
invoice_xml = etree.fromstring(invoice_string)
|
||||
schema = etree.XMLSchema(etree.parse(schema_file))
|
||||
schema.assertValid(invoice_xml)
|
||||
|
||||
@with_transaction()
|
||||
def test_xrechn_export_xml_creditnote(self):
|
||||
|
@ -97,9 +108,20 @@ class EdocTestCase(ModuleTestCase):
|
|||
]
|
||||
|
||||
template = Template(invoice)
|
||||
invoice_string = template.render('XRechnung-2.2')
|
||||
with open('xrechnung-test-creditnote.xml', 'wt') as fhdl:
|
||||
fhdl.write(invoice_string.decode('utf8'))
|
||||
|
||||
schema_file = os.path.join(
|
||||
os.path.dirname(__file__), 'os-UBL-2.1',
|
||||
'xsd', 'maindoc', 'UBL-CreditNote-2.1.xsd')
|
||||
|
||||
for x in ['XRechnung-2.2', 'XRechnung-2.3', 'XRechnung-3.0']:
|
||||
invoice_string = template.render(x)
|
||||
invoice_xml = etree.fromstring(invoice_string)
|
||||
schema = etree.XMLSchema(etree.parse(schema_file))
|
||||
schema.assertValid(invoice_xml)
|
||||
|
||||
# invoice_string = template.render('XRechnung-2.2')
|
||||
# with open('xrechnung-test-creditnote.xml', 'wt') as fhdl:
|
||||
# fhdl.write(invoice_string.decode('utf8'))
|
||||
|
||||
# end EdocTestCase
|
||||
|
||||
|
|
Loading…
Reference in a new issue