Skip to content
Snippets Groups Projects
Commit dde3432f authored by Olivier Dony's avatar Olivier Dony
Browse files

[FIX] res.lang: do not leak `load_language` global

During database creation via the database manager,
or when using the startup option `--load-language`,
the selected language(s) will be installed as soon
as either:
 - the base module is installed/updated (because
base_data.xml includes a call to res.lang.install_lang()
 - the registry is loaded (after loading `base`,
the system installs the requested languages, even
if the server is not in update/install mode)

This is implemented by passing a global config
option `load_lang

This behavior was modified as of saas-7 by PR
for the command-line and for the database manager.

In both cases, we don't want the installation
to be repeated the next time either of these
event occur. Essentially the `load_language`
parent e62b9e7c
Branches
Tags
No related merge requests found
......@@ -278,12 +278,13 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
report = registry._assertion_report
loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=update_module, report=report)
if tools.config['load_language'] or update_module:
load_lang = tools.config.pop('load_language')
if load_lang or update_module:
# some base models are used below, so make sure they are set up
registry.setup_models(cr, partial=True)
if tools.config['load_language']:
for lang in tools.config['load_language'].split(','):
if load_lang:
for lang in load_lang.split(','):
tools.load_language(cr, lang)
# STEP 2: Mark other modules to be loaded/updated
......
......@@ -538,6 +538,9 @@ class configmanager(object):
def get(self, key, default=None):
return self.options.get(key, default)
def pop(self, key, default=None):
return self.options.pop(key, default)
def get_misc(self, sect, key, default=None):
return self.misc.get(sect,{}).get(key, default)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment