From a9beee42d652de63edb0b2153b3028447e4eff03 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 15 Nov 2017 10:44:20 +0100 Subject: [PATCH] [FIX] tools: lang in formatLang - Install French language - Set language of Customer A to French - Create an invoice due in the past - Open the Customer Statements The customer statement of A is translated in French, but the amounts are formatted in the company's user language (English by default). We add the possiblity to take into account the lang in the context when calling `formatLang`. --- odoo/tools/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/tools/misc.py b/odoo/tools/misc.py index ca20ab3278b..6233f4572b1 100644 --- a/odoo/tools/misc.py +++ b/odoo/tools/misc.py @@ -1175,7 +1175,7 @@ def formatLang(env, value, digits=None, grouping=True, monetary=False, dp=False, if isinstance(value, (str, unicode)) and not value: return '' - lang = env.user.company_id.partner_id.lang or 'en_US' + lang = env.context.get('lang') or env.user.company_id.partner_id.lang or 'en_US' lang_objs = env['res.lang'].search([('code', '=', lang)]) if not lang_objs: lang_objs = env['res.lang'].search([], limit=1)