[MERGE] forward port of branch 8.0 up to edbb141

This commit is contained in:
Christophe Simonis
2015-01-19 20:32:56 +01:00
2 changed files with 10 additions and 6 deletions
+7 -4
View File
@@ -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)])]
@@ -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