export xrechnung 2.1 ok + test
This commit is contained in:
parent
7e35688043
commit
1306f2a339
6 changed files with 152 additions and 60 deletions
|
@ -17,56 +17,88 @@
|
|||
<cbc:IdentificationCode>${getattr(getattr(value, 'country', None), 'code', None)}</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyTaxScheme(value)">
|
||||
<cbc:CompanyID>${getattr(value, 'code', None)}</cbc:CompanyID>
|
||||
<cbc:CompanyID>${this.taxident_data(value)['code']}</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
<cbc:ID>${this.taxident_data(value)['id']}</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</py:def>
|
||||
|
||||
<py:def function="Contact(value)">
|
||||
<cbc:Name>${value.name}</cbc:Name>
|
||||
<cbc:Telephone>${value.phone}</cbc:Telephone>
|
||||
<cbc:ElectronicMail>${value.email}</cbc:ElectronicMail>
|
||||
</py:def>
|
||||
|
||||
<py:def function="PartyLegalEntity(value, company_id=True)">
|
||||
<cbc:RegistrationName>${value.name}</cbc:RegistrationName>
|
||||
<cbc:CompanyID py:if="company_id">${getattr(this.seller_trade_tax_identifier, 'code', None)}</cbc:CompanyID>
|
||||
<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>
|
||||
<cbc:ID>${this.tax_category_code(value)}</cbc:ID>
|
||||
<cbc:Percent>${this.tax_rate(value)}</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
${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.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: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>
|
||||
<cbc:ID>bestell-nr</cbc:ID>
|
||||
<cbc:SalesOrderID>auftrags-nr</cbc:SalesOrderID>
|
||||
<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>
|
||||
<cac:ContractDocumentReference py:if="False">
|
||||
<cbc:ID>vertrags-nr</cbc:ID>
|
||||
</cac:ContractDocumentReference>
|
||||
<cac:ProjectReference>
|
||||
<cac:ProjectReference py:if="False">
|
||||
<cbc:ID>proj-referenz</cbc:ID>
|
||||
</cac:ProjectReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
|
@ -137,50 +169,11 @@
|
|||
<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:attrs="{'currencyID': this.invoice.currency.code}">0.00</cbc:ChargeTotalAmount>
|
||||
<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>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="C62">0.5</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">35.00</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Reparaturdienstleistung in Stunden</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>REP-012</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">70.00</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>2</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="C62">3</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">5.25</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Material</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>MAT-987</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">1.75</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<py:for each="line in this.lines">
|
||||
${InvoiceLine(line)}
|
||||
</py:for>
|
||||
</ubl:Invoice>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue