From f0e557cbc69f06c046469ad28e827423735b7280 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Tue, 13 Sep 2016 12:09:02 +0200 Subject: [PATCH] [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. --- addons/website_project_issue/controllers/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website_project_issue/controllers/main.py b/addons/website_project_issue/controllers/main.py index d81d9f69ff9..2ad522d3d4a 100644 --- a/addons/website_project_issue/controllers/main.py +++ b/addons/website_project_issue/controllers/main.py @@ -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']