summaryrefslogtreecommitdiff
path: root/odoo/addons/test_impex/tests/test_load.py
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2019-10-16 12:05:02 +0200
committerMartin Trigaux <mat@odoo.com>2019-11-19 10:37:01 +0100
commit49fbab5329fb95e759c3f90d4e9efb1717a9695c (patch)
tree5ced82c181feb5f9155b27f7ac2aca7b824080c6 /odoo/addons/test_impex/tests/test_load.py
parent7bf6992869804973b41a785037fc176cd608320e (diff)
[IMP] base: split and deprecate load_lang
load_lang was a kind of hybrid method trying to active or creating a language if not found. This was error prone. Instead rely on two methods with clear purpose: ResLang._create_lang(lang, lang_name=None) - create a new res.lang entry using the locale of the server return the res.lang record to match the API of _activate_lang ResLang._active_lang(code) - activate the given code lang Most of the time, _active_lang is what is expected tools.trans_load_data and IrTranslation._load_module_terms no longer activate the language if not active. Loading the translations should be explicit on an activated language, it is too error prone to silently activate/create a language if not found. Remove lang_name from trans_load_data as no longer needed.
Diffstat (limited to 'odoo/addons/test_impex/tests/test_load.py')
-rw-r--r--odoo/addons/test_impex/tests/test_load.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/addons/test_impex/tests/test_load.py b/odoo/addons/test_impex/tests/test_load.py
index d2bd80f7e56..35a3b55d31b 100644
--- a/odoo/addons/test_impex/tests/test_load.py
+++ b/odoo/addons/test_impex/tests/test_load.py
@@ -73,7 +73,7 @@ class ImporterCase(common.TransactionCase):
return '__test__.' + name
def add_translations(self, name, type, code, *tnx):
- self.env['res.lang'].load_lang(code)
+ self.env['res.lang']._activate_lang(code)
Translations = self.env['ir.translation']
for source, value in tnx:
Translations.create({