xrechnung weiter, line fehlt noch

This commit is contained in:
Frederik Jaeckel 2022-10-18 17:33:17 +02:00
parent 265e38c24f
commit 7e35688043
5 changed files with 121 additions and 26 deletions

View file

@ -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
"""