[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.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user