From 1dd5c5065146f35c907f1b6abdc6284ded3ce775 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Tue, 13 Sep 2016 15:21:43 +0200 Subject: [PATCH] [FIX] website_project_issue: apply f0e557c to count controller The goal is to display the number of 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 2ad522d3d4a..e82922b761f 100644 --- a/addons/website_project_issue/controllers/main.py +++ b/addons/website_project_issue/controllers/main.py @@ -14,7 +14,9 @@ class WebsiteAccount(website_account): def _prepare_portal_layout_values(self): values = super(WebsiteAccount, self)._prepare_portal_layout_values() # domain is needed to hide non portal project for employee - issue_count = request.env['project.issue'].search_count([('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')]) + issue_count = request.env['project.issue'].search_count([('project_id', 'in', portal_projects.ids)]) values.update({ 'issue_count': issue_count, })