[FIX] website_forum: remove unnecessary slow code

Since commit 56645335b7
the subtype `gamification.mt_badge_granted` is not used anymore. Therefore
this method will never return anything.

However, it is very costly on performance, and it is run on every page of the
forum! The problematic performance point is that `needaction` is a computed
field, which implies all existing `mail.message` having the target subtype have
to be fetched to compute this field, which obviously does not scale well at all.

closes odoo/odoo#32861

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Sébastien Theys
2019-04-23 07:07:57 +00:00
parent b09d20ab29
commit af02d1da58
+2 -6
View File
@@ -22,12 +22,8 @@ class WebsiteForum(http.Controller):
_user_per_page = 30
def _get_notifications(self):
badge_subtype = request.env.ref('gamification.mt_badge_granted')
if badge_subtype:
msg = request.env['mail.message'].search([('subtype_id', '=', badge_subtype.id), ('needaction', '=', True)])
else:
msg = list()
return msg
"""Deprecated"""
return list()
def _prepare_forum_values(self, forum=None, **kwargs):
values = {