From 7bf6992869804973b41a785037fc176cd608320e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 16 Oct 2019 11:51:06 +0200 Subject: [PATCH] [IMP] base: do not use unactivated language Only activated languages should be used in "amount to text" features. If a language code of a not-used language is used, it should be ignored for consistency with the rest of the interface. --- odoo/addons/base/models/res_currency.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/odoo/addons/base/models/res_currency.py b/odoo/addons/base/models/res_currency.py index 40f1952e219..8bcd9a3d388 100644 --- a/odoo/addons/base/models/res_currency.py +++ b/odoo/addons/base/models/res_currency.py @@ -110,8 +110,7 @@ class Currency(models.Model): integer_value = int(parts[0]) fractional_value = int(parts[2] or 0) - lang_code = self.env.context.get('lang') or self.env.user.lang - lang = self.env['res.lang'].with_context(active_test=False).search([('code', '=', lang_code)]) + lang = tools.get_lang(self.env) amount_words = tools.ustr('{amt_value} {amt_word}').format( amt_value=_num2words(integer_value, lang=lang.iso_code), amt_word=self.currency_unit_label,