[FIX] website_project_issue: fetch the portal projects domain with sudo

The goal of this controller is to display issues that are in projects
with a "portal" privacy setting. However, this setting is used by a
record rule to limit access to the project to followers only; this
means that you should add all the customers who submit issues to your
support project. This makes no sense.

To circumvent this problem, the domain of projects with this visibility
setting is fetched as sudo.
This commit is contained in:
Damien Bouvy
2016-09-13 12:09:02 +02:00
parent 29ed42d901
commit f0e557cbc6
@@ -42,7 +42,9 @@ class WebsiteAccount(website_account):
str(proj.id): {'label': proj.name, 'domain': [('project_id', '=', proj.id)]}
})
domain = [('project_id.privacy_visibility','=','portal')]
# portal users can't see the privacy_visibility, fetch the domain for them in sudo
portal_projects = request.env['project.project'].sudo().search([('privacy_visibility', '=', 'portal')])
domain = [('project_id', 'in', portal_projects.ids)]
domain += project_filters.get(project, project_filters['all'])['domain']
order = sortings.get(sortby, sortings['date'])['order']