[FIX] project: portal should see projects only when he has tasks
before this commit, on /my/tasks, in the filter dropdown, every project that had visibility = portal was displayed regardless of whether the portal user was a follower or not After this commit, we search project in a more clever manner OPW 1878187 closes #26615
This commit is contained in:
@@ -104,7 +104,16 @@ class CustomerPortal(CustomerPortal):
|
||||
}
|
||||
# extends filterby criteria with project (criteria name is the project id)
|
||||
# Note: portal users can't view projects they don't follow
|
||||
projects = request.env['project.project'].sudo().search([('privacy_visibility', '=', 'portal')])
|
||||
partner = request.env.user.partner_id
|
||||
domain_projects = [
|
||||
'&',
|
||||
('privacy_visibility', '=', 'portal'),
|
||||
'|',
|
||||
('message_partner_ids', 'child_of', [partner.commercial_partner_id.id]),
|
||||
('task_ids.message_partner_ids', 'child_of', [partner.commercial_partner_id.id])
|
||||
]
|
||||
|
||||
projects = request.env['project.project'].sudo().search(domain_projects)
|
||||
domain = [('project_id', 'in', projects.ids)]
|
||||
for proj in projects:
|
||||
searchbar_filters.update({
|
||||
|
||||
Reference in New Issue
Block a user