Rendering commas or setting locale breaks precision
chaghi opened this issue · comments
Using Beancount 2.3.5 2.3.6 and Fava 1.26.1
If Beancount's render_commas
is True
or Fava's locale
is set, the precision is ignored and the account balance is shown with the wrong precision.
Minimal example file:
option "operating_currency" "ARS"
;option "render_commas" "TRUE"
2023-01-01 custom "fava-option" "locale" "es_AR"
2023-01-01 commodity ARS
name: "Argentine Peso ($)"
precision: 2
2023-01-01 open Assets:Broker:XXX XXX
2023-01-01 open Assets:Cash ARS
2023-01-01 * "Buy some XXX"
Assets:Broker:XXX 6164.93 XXX {18.792541616 ARS}
Assets:Cash
2023-01-02 balance Assets:Broker:XXX 6164.93 XXX
Result
The balance shows 115.854,704
.
The same occurs if locale
is commented out and render_commas
is uncommented.
http://127.0.0.1:5000/locale-format/balance_sheet/
Expected result
The balance should display 115.854,70
If I don't set a locale
and set render_commas
to False
, the balance is correcly rounded (but of course then I lose the thousands separator, and get the wrong decimal separator for my language).
Hi, thanks for the report and for providing an example file to reproduce this.
These account tree are now rendered in the frontend and there is a bug in the Javasript-side locale formatting: we only set the minimum number of fractional digits and not the maximum. Should be fixed with #1711