Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Project

Entity: project.task

Compute Method: _compute_display_follow_button

View 19.0 View 20.0
Inputs Method Outputs
  • project_id
  • project_id.ids
if not self.env.user.share:
            self.display_follow_button = False
            return
- project_collaborator_read_group = self.env['project.collaborator']._read_group(
-             [('project_id', 'in', self.project_id.ids), ('partner_id', '=', self.env.user.partner_id.id)],
-             ['project_id'],
-             ['limited_access:bool_and'],
-         )
- limited_access_per_project_id = dict(project_collaborator_read_group)
+ collaborator_projects = self.env['project.collaborator'].sudo().search([
+             ('project_id', 'in', self.project_id.ids),
+             ('partner_id', '=', self.env.user.partner_id.id)
+         ])
+ collaborator_project_ids = collaborator_projects.mapped('project_id')
for task in self:
-             task.display_follow_button = not limited_access_per_project_id.get(task.project_id, True)
+             task.display_follow_button = task.project_id in collaborator_project_ids
  • display_follow_button

Back to entity