[FIX] website_forum: Empty question error

Steps to reproduce the bug:

- Ask a question in the forum with a title but with no content

Bug:

A traceback was raised.

opw:2093665

closes odoo/odoo#39675

X-original-commit: 51f660c9a66f2e6aecb51e476d815b2f083f843d
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-10-31 16:38:08 +00:00
committed by fw-bot
parent b9ad9f4991
commit 8588649c12
+2 -2
View File
@@ -301,7 +301,7 @@ class WebsiteForum(WebsiteProfile):
type='http', auth="user", methods=['POST'], website=True)
def post_create(self, forum, post_parent=None, **post):
if post.get('content', '') == '<p><br></p>':
return request.render('website.http_error', {
return request.render('http_routing.http_error', {
'status_code': _('Bad Request'),
'status_message': post_parent and _('Reply should not be empty.') or _('Question should not be empty.')
})
@@ -370,7 +370,7 @@ class WebsiteForum(WebsiteProfile):
@http.route('/forum/<model("forum.forum"):forum>/post/<model("forum.post"):post>/save', type='http', auth="user", methods=['POST'], website=True)
def post_save(self, forum, post, **kwargs):
if 'post_name' in kwargs and not kwargs.get('post_name').strip():
return request.render('website.http_error', {
return request.render('http_routing.http_error', {
'status_code': _('Bad Request'),
'status_message': _('Title should not be empty.')
})