From 3b9cd536607b1631dd375ab2e5cc94eb814a6e9b Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Fri, 12 Feb 2021 08:44:54 +0000 Subject: [PATCH] [IMP] base: check fallback on AccessDenied MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, we only check if another endpoint can be serve in case of 404 not found. Idea was that each url has only one endpoint. Fun effect is that if record doesn't exist, route doesn't match, so in reality we had one endpoint but we fallback too to check if another match. But it doesn't match a recurring case, when you archive a record, and want to create a redirect for your seo and customer to another record, it is just ignored because the url math a controller (that return 403 since you don't have anymore the access right) Since ask to the customer to delete the record is not always possible (e.g. a product already sold) now we check if a fallback match for 403. closes odoo/odoo#66030 Signed-off-by: Jérémy Kersten (jke) --- odoo/addons/base/models/ir_http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_http.py b/odoo/addons/base/models/ir_http.py index d6152f2e6d5..7b3b9b335bc 100644 --- a/odoo/addons/base/models/ir_http.py +++ b/odoo/addons/base/models/ir_http.py @@ -191,7 +191,8 @@ class IrHttp(models.AbstractModel): # This is done first as the attachment path may # not match any HTTP controller - if isinstance(exception, werkzeug.exceptions.HTTPException) and exception.code == 404: + if (isinstance(exception, werkzeug.exceptions.HTTPException) and exception.code == 404) or \ + (isinstance(exception, odoo.exceptions.AccessError)): serve = cls._serve_fallback(exception) if serve: return serve