reports: BaseODS gets decimalplaces directly from Babel.

This commit is contained in:
Brett Smith 2020-09-04 14:20:11 -04:00
parent 2c3438ba0f
commit 44ac5e61f7

View file

@ -755,13 +755,6 @@ class BaseODS(BaseSpreadsheet[RT, ST], metaclass=abc.ABCMeta):
grouping = pattern.grouping[0]
else:
grouping = pattern.grouping[fmt_index]
zero_s = babel.numbers.format_currency(0, code, '##0.0', locale)
try:
decimal_index = zero_s.rindex('.') + 1
except ValueError:
decimalplaces = 0
else:
decimalplaces = len(zero_s) - decimal_index
style = self.replace_child(
root,
odf.number.CurrencyStyle,
@ -775,7 +768,7 @@ class BaseODS(BaseSpreadsheet[RT, ST], metaclass=abc.ABCMeta):
pass
elif not part.strip('#0,.'):
style.addElement(odf.number.Number(
decimalplaces=str(decimalplaces),
decimalplaces=str(pattern.frac_prec[0]),
grouping='true' if grouping else 'false',
minintegerdigits=str(minintegerdigits),
))