[FIX] website_project_issue: Only portal issues must be visible

When going to routes ['/my', '/my/home'], only the project issues in
portal privacy visibility must be displayed.
Inpired from 56c5d0a
The field privacy_visibility is not accessible in portal due to access
rights.

opw:676447
This commit is contained in:
Goffin Simon
2016-06-23 09:40:51 +02:00
parent d14efd562b
commit 55bdf0e8ff
@@ -10,7 +10,15 @@ class WebsiteAccount(website_account):
def account(self):
response = super(WebsiteAccount, self).account()
user = request.env.user
project_issues = request.env['project.issue'].search([])
# TDE FIXME: shouldn't that be mnaged by the access rule itself ?
# portal projects where you or someone from your company are a follower
project_issues = request.env['project.issue'].sudo().search([
'&',
('project_id.privacy_visibility', '=', 'portal'),
'|',
('message_partner_ids', 'child_of', [user.partner_id.commercial_partner_id.id]),
('message_partner_ids', 'child_of', [user.partner_id.id])
])
response.qcontext.update({'issues': project_issues})
return response