Files
odoo_source/addons/http_routing/controllers/main.py
T
Jeremy Kersten 914fe1085e [FIX] http_routing: avoid extra redirect on logout in multi lang
context:
Connected in /fr on a website with /en as default lang.

Before this commit,
  /web/session/logout?redirect=/
  /
  /fr_FR/
  /fr_FR

Now
  /web/session/logout?redirect=/
  /fr_FR

Part 1 -> to say that we are in multilang context and use url_lang.
   multilang=False to avoid /web/session -> /fr/web/session
   website=True to have url_lang done in the request.redirect.
Part 2 -> to remove the trailing '/' that will be only useful for '/'

closes odoo/odoo#76290

X-original-commit: ae35117ee1e019c3c0c333f291478825a5722706
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-09-10 08:49:13 +00:00

25 lines
883 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http
from odoo.http import request
from odoo.addons.web.controllers.main import WebClient, Home, Session
class Routing(Home):
@http.route('/website/translations/<string:unique>', type='http', auth="public", website=True)
def get_website_translations(self, unique, lang=None, mods=None):
IrHttp = request.env['ir.http'].sudo()
modules = IrHttp.get_translation_frontend_modules()
if mods:
modules += mods
return WebClient().translations(unique, mods=','.join(modules), lang=lang)
class SessionWebsite(Session):
@http.route('/web/session/logout', type='http', auth="none", website=True, multilang=False, sitemap=False)
def logout(self, redirect='/web'):
return super().logout(redirect=redirect)