diff --git a/addons/http_routing/models/ir_http.py b/addons/http_routing/models/ir_http.py index 126fa64d5fb..6b2872f45b2 100644 --- a/addons/http_routing/models/ir_http.py +++ b/addons/http_routing/models/ir_http.py @@ -383,7 +383,7 @@ class IrHttp(models.AbstractModel): if nearest_lang: lang = Lang._lang_get(nearest_lang) else: - nearest_ctx_lg = not is_a_bot and cls.get_nearest_lang(request.env.context['lang']) + nearest_ctx_lg = not is_a_bot and cls.get_nearest_lang(request.env.context.get('lang')) nearest_ctx_lg = nearest_ctx_lg in lang_codes and nearest_ctx_lg preferred_lang = Lang._lang_get(cook_lang or nearest_ctx_lg) lang = preferred_lang or cls._get_default_lang()