Browse Source

Fix EUR formatting

master
Peter Hatina 2 years ago
parent
commit
f3e805f7ad
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      lib/invoice/cli.py

+ 6
- 1
lib/invoice/cli.py View File

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

log.debug("Creating TeX invoice...")
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(
invoice=invoice_data,
issuer=issuer_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))
assert(os.path.exists(tex_file))



Loading…
Cancel
Save