[FIX] website_forum: add default value for forum_origin

We have a lot of hits without any forum_origin which will raise an
error 500 because this parameter is required. But because this params is
not into the controller but received as a get parameter, it will match
the controller and return an error 500 instead of a beautiful 404.

Some controller like 'open_partner' redirect to this url without the
parameter forum_origin too, leading in a 500 in all cases.

Better for uX to have this param, but not critical to display the page.
The only negative impact will be to have a 'Back' button that return to
this new default value '/forum'.

closes odoo/odoo#114461

X-original-commit: 991d1c430f2c9bb0d2b2d7ac8f75338eafd2aced
Signed-off-by: Jérémy Kersten <jke@odoo.com>
This commit is contained in:
Jeremy Kersten
2023-03-07 02:56:41 +01:00
parent 2e435e53a6
commit f20f6667fa
+1 -1
View File
@@ -561,7 +561,7 @@ class WebsiteForum(WebsiteProfile):
# -----------------------------------
@http.route(['/forum/<model("forum.forum"):forum>/user/<int:user_id>'], type='http', auth="public", website=True)
def view_user_forum_profile(self, forum, user_id, forum_origin, **post):
def view_user_forum_profile(self, forum, user_id, forum_origin='/forum', **post):
return request.redirect('/profile/user/' + str(user_id) + '?forum_id=' + str(forum.id) + '&forum_origin=' + str(forum_origin))
def _prepare_user_profile_values(self, user, **post):