[FIX] auth_signup: properly grab user lang from context

Follow up on d0a4b20d36

The `lang` at this step is compared to the locale `code` (eg. fr_BE) so the
split is a mistake.

To reproduce the issue:
- change the language of a website to fr_BE only
- allow free signup
- register as a new user

Notice how the language of the user is set to en_US before this PR instead of
fr_BE as it should be.

closes #63616

closes odoo/odoo#64089

X-original-commit: ba21dadf17ba96ecbba917f666a3b385d9b9fd5e
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Sébastien Theys
2021-01-05 14:04:21 +00:00
parent 30f2a7f149
commit 828ea9c523
+1 -1
View File
@@ -124,7 +124,7 @@ class AuthSignupHome(Home):
if values.get('password') != qcontext.get('confirm_password'):
raise UserError(_("Passwords do not match; please retype them."))
supported_lang_codes = [code for code, _ in request.env['res.lang'].get_installed()]
lang = request.context.get('lang', '').split('_')[0]
lang = request.context.get('lang', '')
if lang in supported_lang_codes:
values['lang'] = lang
self._signup_with_values(qcontext.get('token'), values)