From 0184788ebdba43b98ca7f56d138c03cb25584fa0 Mon Sep 17 00:00:00 2001 From: Saurabh Mishra Date: Tue, 30 May 2023 09:56:41 +0000 Subject: [PATCH] [FIX] website: redirect only when url_to given While creating redirects/rewrite if the user does not enter any url in the 'Url to' field of the website module under 'Configuartion/Redirects' then during redirection, the error 'NotFound: 404 Not Found: The requested URL was not found on the server' will be produced. Applying this commit will solve the issue. sentry-4206504892 closes odoo/odoo#123391 X-original-commit: 14a850976711431f36b7f889ea9cf31b1114513d Signed-off-by: Romain Derie (rde) Signed-off-by: Saurabh Mishra (sami) --- addons/website/models/website_rewrite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/models/website_rewrite.py b/addons/website/models/website_rewrite.py index 8ed9b8025f1..467e8845c0f 100644 --- a/addons/website/models/website_rewrite.py +++ b/addons/website/models/website_rewrite.py @@ -82,7 +82,7 @@ class WebsiteRewrite(models.Model): @api.constrains('url_to', 'url_from', 'redirect_type') def _check_url_to(self): for rewrite in self: - if rewrite.redirect_type == '308': + if rewrite.redirect_type in ['301', '302', '308']: if not rewrite.url_to: raise ValidationError(_('"URL to" can not be empty.')) elif not rewrite.url_to.startswith('/'):