When overriding an existing controller route, developers can easily c/p the route definition and call super() in the overridden method when the route attributes are automatically deducted by odoo from the parent route. Removing those redefined attributes simplifies the routes definition, clearly highlighting what's changed by the override. Also reduces unexpected behavior when modifying the base route without noticing/considering the redefined attributes in a overridden route, which overrides the changes made to the base route when the sub-module is installed. This commit adds a test to catch routes attributes redefinition, and clean existing routes. closes odoo/odoo#108512 Related: odoo/enterprise#35176 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
26 lines
940 B
Python
26 lines
940 B
Python
# 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.home import Home
|
|
from odoo.addons.web.controllers.session import Session
|
|
from odoo.addons.web.controllers.webclient import WebClient
|
|
|
|
|
|
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.split(',')
|
|
return WebClient().translations(unique, mods=','.join(modules), lang=lang)
|
|
|
|
|
|
class SessionWebsite(Session):
|
|
|
|
@http.route('/web/session/logout', website=True, multilang=False, sitemap=False)
|
|
def logout(self, redirect='/web'):
|
|
return super().logout(redirect=redirect)
|