[IMP] base: widget currency, allow to force decimal_places

This commit allow to add in t-options the decimal_places.
It is useful in case all price are without decimal e.g.

closes odoo/odoo#120036

X-original-commit: 800d18f2e9f94c68ebca281c9956abb23e7e33e6
Signed-off-by: Thibault Francois <tfr@odoo.com>
Signed-off-by: Jérémy Kersten <jke@odoo.com>
This commit is contained in:
Jeremy Kersten
2023-04-28 08:57:58 +02:00
parent a449b05221
commit 855da5757f
+1 -1
View File
@@ -453,7 +453,7 @@ class MonetaryConverter(models.AbstractModel):
# lang.format will not set one by default. currency.round will not
# provide one either. So we need to generate a precision value
# (integer > 0) from the currency's rounding (a float generally < 1.0).
fmt = "%.{0}f".format(display_currency.decimal_places)
fmt = "%.{0}f".format(options.get('decimal_places', display_currency.decimal_places))
if options.get('from_currency'):
date = options.get('date') or fields.Date.today()