diff options
| author | Martin Trigaux <mat@odoo.com> | 2019-08-06 15:07:41 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2019-08-07 13:06:17 +0000 |
| commit | 85ee046b37c7c9a0dc7f052b8258f81774b127de (patch) | |
| tree | 9a7da9025a665ffc52dff9849af4dc9d69e8892d /addons/website/wizard/base_language_install.py | |
| parent | f5cd483216af01001f44a41f7d48f042b9f56ff9 (diff) | |
[IMP] *: use res.lang methods
get_installed and _lang_get_id are both ormcached and correctly check
the context
Retrieving a res.lang from a code is a frequent action that can be
achieved with _lang_get (cf previous commit).
Using _lang_get ensure the active_test in the context is correct and
is not poluted with another context propagation issue.
odoo/odoo#35490 discussion is an example of bad context propagation
closes odoo/odoo#35504
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'addons/website/wizard/base_language_install.py')
| -rw-r--r-- | addons/website/wizard/base_language_install.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website/wizard/base_language_install.py b/addons/website/wizard/base_language_install.py index 982645b3278..b3c6225f951 100644 --- a/addons/website/wizard/base_language_install.py +++ b/addons/website/wizard/base_language_install.py @@ -22,7 +22,7 @@ class BaseLanguageInstall(models.TransientModel): def lang_install(self): action = super(BaseLanguageInstall, self).lang_install() - lang = self.env['res.lang'].search([('code', '=', self.lang)], limit=1) + lang = self.env['res.lang']._lang_get(self.lang) if self.website_ids and lang: self.website_ids.write({'language_ids': [(4, lang.id)]}) params = self._context.get('params', {}) |
