[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`.
This commit is contained in:
Nicolas Martinelli
2017-11-15 12:57:19 +01:00
parent 0a775adda8
commit a9beee42d6
+1 -1
View File
@@ -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)