xrechnung weiter, line fehlt noch
This commit is contained in:
parent
265e38c24f
commit
7e35688043
5 changed files with 121 additions and 26 deletions
31
edocument.py
31
edocument.py
|
@ -4,14 +4,43 @@
|
|||
# full copyright notices and license terms.
|
||||
|
||||
import genshi.template
|
||||
import os
|
||||
import os, html
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
from trytond.modules.edocument_uncefact.edocument import Invoice
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
class Invoice(Invoice):
|
||||
'EDocument XRechnung'
|
||||
__name__ = 'edocument.xrechnung.invoice'
|
||||
|
||||
def prepaid_amount(self, invoice):
|
||||
""" compute already paid amount
|
||||
"""
|
||||
return invoice.total_amount - invoice.amount_to_pay
|
||||
|
||||
def tax_rate(self, tax):
|
||||
""" get tax-rate in procent
|
||||
"""
|
||||
return (tax.tax.rate * Decimal('100.0')).quantize(Decimal('0.01'))
|
||||
|
||||
def tax_category_code(self, tax):
|
||||
""" read tax-category, fire exception if missing
|
||||
"""
|
||||
if len(tax.tax.unece_category_code or '') == 0:
|
||||
raise UserError(gettext(
|
||||
'edocument_xrechnung.mds_tax_category_missing',
|
||||
taxname = tax.rec_name,
|
||||
))
|
||||
return tax.tax.unece_category_code
|
||||
|
||||
def quote_text(self, text):
|
||||
""" replace critical chars
|
||||
"""
|
||||
if text is not None:
|
||||
return html.quote(text)
|
||||
|
||||
def _get_template(self, version):
|
||||
""" load our own template if 'version' is ours
|
||||
"""
|
||||
|
|
51
locale/de.po
51
locale/de.po
|
@ -10,6 +10,10 @@ msgctxt "model:ir.message,text:msg_missing_xrechnung_route_id"
|
|||
msgid "No XRechnung routing ID is stored for the party '%(partyname)s'."
|
||||
msgstr "Für die Partei '%(partyname)s' ist keine XRechnung-Leitweg-ID hinterlegt."
|
||||
|
||||
msgctxt "model:ir.message,text:mds_tax_category_missing"
|
||||
msgid "The UNECE tax category is not configured for tax '%(taxname)s'."
|
||||
msgstr "Für die Steuer '%(taxname)s' ist die UNECE-Steuerkategorie nicht konfiguriert."
|
||||
|
||||
|
||||
#######################
|
||||
# party.configuration #
|
||||
|
@ -18,3 +22,50 @@ msgctxt "selection:party.configuration,identifier_types:"
|
|||
msgid "X-Rechnung Route-ID"
|
||||
msgstr "X-Rechnung Leitweg-ID"
|
||||
|
||||
|
||||
###############
|
||||
# account.tax #
|
||||
###############
|
||||
msgctxt "field:account.tax,xrtax_category:"
|
||||
msgid "Tax Category"
|
||||
msgstr "Steuerkategorie"
|
||||
|
||||
msgctxt "help:account.tax,xrtax_category:"
|
||||
msgid "Tax Category for eDocument - XRechnung"
|
||||
msgstr "Steuerkategorie für eDocument - XRechnung"
|
||||
|
||||
msgctxt "selection:account.tax,xrtax_category:"
|
||||
msgid "Standard"
|
||||
msgstr "Standardsatz"
|
||||
|
||||
msgctxt "selection:account.tax,xrtax_category:"
|
||||
msgid "Products at zero rate"
|
||||
msgstr "Waren zum Nullsatz"
|
||||
|
||||
msgctxt "selection:account.tax,xrtax_category:"
|
||||
msgid "Exempt"
|
||||
msgstr "Steuerbefreit"
|
||||
|
||||
msgctxt "selection:account.tax,xrtax_category:"
|
||||
msgid "Reverse charge mechanism"
|
||||
msgstr "Umkehrung der Steuerschuldnerschaft"
|
||||
|
||||
msgctxt "selection:account.tax,xrtax_category:"
|
||||
msgid "Tax-exempt for intra-community supply of goods and services in the EEA"
|
||||
msgstr "Steuerbefreit für die innergem. Lieferung von W. u. D. im EWR"
|
||||
|
||||
msgctxt "selection:account.tax,xrtax_category:"
|
||||
msgid "Free export item; Tax not levied"
|
||||
msgstr "Kostenloser Exportartikel; Steuer nicht erhoben"
|
||||
|
||||
msgctxt "selection:account.tax,xrtax_category:"
|
||||
msgid "Non-tax services"
|
||||
msgstr "Dienstleistungen außerhalb des Steuerbereichs"
|
||||
|
||||
msgctxt "selection:account.tax,xrtax_category:"
|
||||
msgid "General indirect tax of the Canary Islands"
|
||||
msgstr "Allgemeine indirekte Steuer der kanarischen Inseln"
|
||||
|
||||
msgctxt "selection:account.tax,xrtax_category:"
|
||||
msgid "Tax on production; services and imports in Ceuta and Melilla"
|
||||
msgstr "Steuer für Produktion; Dienstleistungen und Einfuhr in Ceuta und Melilla"
|
||||
|
|
|
@ -8,5 +8,9 @@ full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_missing_xrechnung_route_id">
|
||||
<field name="text">No XRechnung routing ID is stored for the party '%(partyname)s'.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="mds_tax_category_missing">
|
||||
<field name="text">The UNECE tax category is not configured for tax '%(taxname)s'.</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
1
party.py
1
party.py
|
@ -21,6 +21,7 @@ class Party(metaclass=PoolMeta):
|
|||
'edocument_xrechnung.msg_missing_xrechnung_route_id',
|
||||
partyname = self.rec_name,
|
||||
))
|
||||
|
||||
# end Party
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,26 @@
|
|||
</py:def>
|
||||
<py:def function="PartyLegalEntity(value, company_id=True)">
|
||||
<cbc:RegistrationName>${value.name}</cbc:RegistrationName>
|
||||
<cbc:CompanyID py:if test="company_id">${getattr(value.tax_identifier, 'code', None)}</cbc:CompanyID>
|
||||
<cbc:CompanyID py:if="company_id">${getattr(this.seller_trade_tax_identifier, 'code', None)}</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="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>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</py:def>
|
||||
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.1</cbc:CustomizationID>
|
||||
|
@ -59,7 +78,7 @@
|
|||
${PartyTaxScheme(this.seller_trade_tax_identifier)}
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
${PartyLegalEntity(this.invoice.company.party)}
|
||||
${PartyLegalEntity(this.seller_trade_party)}
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
${Contact(this.seller_trade_party)}
|
||||
|
@ -89,14 +108,13 @@
|
|||
<cbc:PaymentMeansCode>30</cbc:PaymentMeansCode>
|
||||
<cbc:PaymentID>${this.payment_reference}</cbc:PaymentID>
|
||||
<cac:PayeeFinancialAccount>
|
||||
<cbc:ID>DE00 1234 5678 0000 1234 56</cbc:ID>
|
||||
<cbc:Name>${this.invoice.company.party.name}</cbc:Name>
|
||||
${PayeeFinancialAccount(this.seller_trade_party)}
|
||||
</cac:PayeeFinancialAccount>
|
||||
</cac:PaymentMeans>
|
||||
<cac:PaymentTerms py:if test="this.invoice.payment_term is not None">
|
||||
<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 test="False">
|
||||
<cac:AllowanceCharge py:if="False">
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Neukundenrabatt</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">5.00</cbc:Amount>
|
||||
|
@ -109,27 +127,19 @@
|
|||
</cac:TaxCategory>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount py:attrs={'currencyID': this.invoice.currency.code}>${this.invoice.total_amount}</cbc:TaxAmount>
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount py:attrs={'currencyID': this.invoice.currency.code}>35.25</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount py:attrs={'currencyID': this.invoice.currency.code}>6.70</cbc:TaxAmount>
|
||||
<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:TaxSubtotal>
|
||||
<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}>40.25</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount py:attrs={'currencyID': this.invoice.currency.code}>35.25</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount py:attrs={'currencyID': this.invoice.currency.code}>41.95</cbc:TaxInclusiveAmount>
|
||||
<cbc:AllowanceTotalAmount py:attrs={'currencyID': this.invoice.currency.code}>5.00</cbc:AllowanceTotalAmount>
|
||||
<cbc:ChargeTotalAmount py:attrs={'currencyID': this.invoice.currency.code}>0.00</cbc:ChargeTotalAmount>
|
||||
<cbc:PrepaidAmount py:attrs={'currencyID': this.invoice.currency.code}>0.00</cbc:PrepaidAmount>
|
||||
<cbc:PayableAmount py:attrs={'currencyID': this.invoice.currency.code}>41.95</cbc:PayableAmount>
|
||||
<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: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>
|
||||
|
|
Loading…
Reference in a new issue