diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index b5b4d288c15..40a42920063 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -438,16 +438,19 @@ class WebsiteForum(http.Controller): (count_user_questions and current_user.karma > forum.karma_unlink_all))): return request.website.render("website_forum.private_profile", values) - # displaying only the 20 most recent questions - user_questions = user_question_ids[:20] + # limit length of visible posts by default for performance reasons, except for the high + # karma users (not many of them, and they need it to properly moderate the forum) + post_display_limit = None + if current_user.karma < forum.karma_unlink_all: + post_display_limit = 20 + user_questions = user_question_ids[:post_display_limit] user_answer_ids = Post.search([ ('parent_id', '!=', False), ('forum_id', '=', forum.id), ('create_uid', '=', user.id)], order='create_date desc') count_user_answers = len(user_answer_ids) - # displaying only the 20 most recent answers - user_answers = user_answer_ids[:20] + user_answers = user_answer_ids[:post_display_limit] # showing questions which user following post_ids = [follower.res_id for follower in Followers.sudo().search([('res_model', '=', 'forum.post'), ('partner_id', '=', user.partner_id.id)])] diff --git a/openerp/addons/test_new_api/tests/test_related.py b/openerp/addons/test_new_api/tests/test_related.py index e7ba6b8b184..b2b65e8b373 100644 --- a/openerp/addons/test_new_api/tests/test_related.py +++ b/openerp/addons/test_new_api/tests/test_related.py @@ -52,8 +52,9 @@ class TestRelatedField(common.TransactionCase): company_ids = self.company.search(self.cr, self.uid, [('partner_id', '!=', False)], limit=1) company = self.company.browse(self.cr, self.uid, company_ids[0]) - # find partners that satisfy [('partner_id.company_id', '=', company.id)] - partner_ids = self.partner.search(self.cr, self.uid, [('related_company_partner_id', '=', company.id)]) + # find partners that satisfy [('company_id.partner_id', '=', company.partner_id.id)] + partner_ids = self.partner.search(self.cr, self.uid, [('related_company_partner_id', '=', company.partner_id.id)]) + self.assertGreater(len(partner_ids), 0) partner = self.partner.browse(self.cr, self.uid, partner_ids[0]) # create a new partner, and assign it to company