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.project

Compute Method: _compute_collaborator_count

View 17.0 View 19.0
Inputs Method Outputs
  • id
- project_sharings = self.filtered(lambda project: project.privacy_visibility == 'portal')
+ project_sharings = self.filtered(lambda project: project.privacy_visibility in ['invited_users', 'portal'])
collaborator_read_group = self.env['project.collaborator']._read_group(
            [('project_id', 'in', project_sharings.ids)],
            ['project_id'],
            ['__count'],
        )
collaborator_count_by_project = {project.id: count for project, count in collaborator_read_group}
for project in self:
            project.collaborator_count = collaborator_count_by_project.get(project.id, 0)
  • collaborator_count

Back to entity