From 855da5757fd43cdb873cfe3bf826a033d69ef589 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 27 Apr 2023 14:53:33 +0000 Subject: [PATCH] [IMP] base: widget currency, allow to force decimal_places MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Jérémy Kersten --- odoo/addons/base/models/ir_qweb_fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_qweb_fields.py b/odoo/addons/base/models/ir_qweb_fields.py index c5e98099a7c..2d9bbc11ca8 100644 --- a/odoo/addons/base/models/ir_qweb_fields.py +++ b/odoo/addons/base/models/ir_qweb_fields.py @@ -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()