summaryrefslogtreecommitdiff
path: root/addons/auth_signup/controllers/main.py
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2019-09-05 12:31:57 +0000
committerSébastien Theys <seb@odoo.com>2019-09-05 12:31:57 +0000
commitd0a4b20d3660c09b1ebe203125d57c9a533c7957 (patch)
tree7bd90316d14145123a1296ea189c7fa1bb84a9f8 /addons/auth_signup/controllers/main.py
parent8ad3e221bb54633e82f17b32ba95a562f65ed360 (diff)
[FIX] auth_signup: prevent crash if http_routing not installed
Follow up of 269aa594111a152ad4b7714856ea745bfef57155 `request.lang` is only set on `http_routing` so it cannot be used here. The fix here is the same as what was done on `web` on the mentioned commit. To reproduce the issue: - install any module, but not `http_routing` - use reset password - try to set a new password from the received link with token A few notes about the mentioned commit: - the `lang` `lazy_property` was removed because it was a string before and a record now, and lazy_property cannot return a record - the `lang` on the `request` is now a record - the `lang` on the `context` is still a string closes odoo/odoo#36468 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Diffstat (limited to 'addons/auth_signup/controllers/main.py')
-rw-r--r--addons/auth_signup/controllers/main.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py
index 6f21118e369..986278e2ab3 100644
--- a/addons/auth_signup/controllers/main.py
+++ b/addons/auth_signup/controllers/main.py
@@ -124,8 +124,9 @@ 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()]
- if request.lang.code in supported_lang_codes:
- values['lang'] = request.lang.code
+ lang = request.context.get('lang', '').split('_')[0]
+ if lang in supported_lang_codes:
+ values['lang'] = lang
self._signup_with_values(qcontext.get('token'), values)
request.env.cr.commit()