Bläddra i källkod

Fix EUR formatting

master
Peter Hatina 2 år sedan
förälder
incheckning
f3e805f7ad
1 ändrade filer med 6 tillägg och 1 borttagningar
  1. +6
    -1
      lib/invoice/cli.py

+ 6
- 1
lib/invoice/cli.py Visa fil

@@ -179,11 +179,16 @@ class Application:


log.debug("Creating TeX invoice...") log.debug("Creating TeX invoice...")
self._check_path(self.tmp_path) self._check_path(self.tmp_path)

format_decimal=lambda x: '{:20,.2f}'.format(x).replace(',', '\\,').replace('.', ',')
format_eur=lambda x: format_decimal(x) + ' EUR'

result = tempita.Template(open(tex_template).read()).substitute( result = tempita.Template(open(tex_template).read()).substitute(
invoice=invoice_data, invoice=invoice_data,
issuer=issuer_data, issuer=issuer_data,
customer=customer_data, customer=customer_data,
eur=lambda x: '{:20,.2f} EUR'.format(x).replace(',', '\\,').replace('.', ','))
decimal=format_decimal,
eur=format_eur)
open(tex_file, "w").write(str(result)) open(tex_file, "w").write(str(result))
assert(os.path.exists(tex_file)) assert(os.path.exists(tex_file))




Laddar…
Avbryt
Spara