Format float and computed Decimal using fixed-point notation

This avoid the usage of scientific notation.
For float we must convert them to Decimal to get a precision large enough to
show all coefficient digits.
For computed Decimal (which are thus not rounded) we must normalized them first
to avoid trailing 0.

Closes #14522
This commit is contained in:
Cédric Krier committed 2026-01-20 09:19:12 +01:00
1 parent 8ae58308ce
commit 680344c92b
5 files changed
+18 -12

No files matched your search

+4 -1
View File
@@ -2,6 +2,7 @@
# this repository contains the full copyright notices and license terms.
import functools
import os
from decimal import Decimal
import genshi
import genshi.template
@@ -78,7 +79,9 @@ class Invoice(Model):
tmpl = self._get_template(template)
if not tmpl:
raise NotImplementedError
return (tmpl.generate(this=self)
return (tmpl.generate(
this=self,
Decimal=Decimal)
.filter(remove_comment)
.render()
.encode('utf-8'))