From 6331cd1ff5cdabc92a7ae1e11f2096a8889bae34 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 14 Jul 2017 15:27:48 +0200 Subject: [PATCH] [FIX] base: QWeb monetary format - Set the currency precision to 0.05 - Print any QWeb report displaying amounts, e.g. the GL The amounts are displayed with 1 digit precision instead of 2. The formula used to compute the decimal places is actually wrong. The correct one can be found in method `_decimal_places`. Anyway, we can use directly the field. opw-752283 --- openerp/addons/base/ir/ir_qweb.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index ea996769f88..5af09a6b9e1 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -1051,8 +1051,7 @@ class QwebWidgetMonetary(osv.AbstractModel): def _format(self, inner, options, qwebcontext): inner = self.pool['ir.qweb'].eval(inner, qwebcontext) display = self.pool['ir.qweb'].eval_object(options['display_currency'], qwebcontext) - precision = int(round(math.log10(display.rounding))) - fmt = "%.{0}f".format(-precision if precision < 0 else 0) + fmt = "%.{0}f".format(display.decimal_places) lang_code = qwebcontext.context.get('lang') or 'en_US' formatted_amount = self.pool['res.lang'].format( qwebcontext.cr, qwebcontext.uid, [lang_code], fmt, inner, grouping=True, monetary=True