[FIX] http_routing: can't redirect the user to friendly access error
-Step to reproduce: create a custom module and try to extend method in
website_slides controller like this:
@http.route(sitemap=sitemap_slide_view)
def slide_view(self, slide, **kwargs):
return super(WebsiteSlidesSeo, self).slide_view(slide, **kwargs)
From there, 'rule.endpoint.original_routing' will take the value from
the extend method not the original one therefore user will one again go
to the the forbidden error page which is'n friendly. We shouldn't access
original_routing because that's the "function's specific @http.route"
closes odoo/odoo#160864
-solution: we only need rule.endpoint.routing because it is the one holding the "merged @http.route accross inherited controllers".
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
This commit is contained in:
@@ -210,7 +210,7 @@ class IrHttp(models.AbstractModel):
|
||||
args[key].check_access_rule('read')
|
||||
except (odoo.exceptions.AccessError, odoo.exceptions.MissingError) as e:
|
||||
# custom behavior in case a record is not accessible / has been removed
|
||||
if handle_error := rule.endpoint.original_routing.get('handle_params_access_error'):
|
||||
if handle_error := rule.endpoint.routing.get('handle_params_access_error'):
|
||||
if response := handle_error(e):
|
||||
werkzeug.exceptions.abort(response)
|
||||
if isinstance(e, odoo.exceptions.MissingError):
|
||||
|
||||
Reference in New Issue
Block a user