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: account.analytic.account

Compute Method: _compute_project_count

Inputs Method Outputs
  • id
project_data = self.env['project.project']._read_group([('account_id', 'in', self.ids)], ['account_id'], ['__count'])
mapping = {analytic_account.id: count for analytic_account, count in project_data}
for account in self:
            account.project_count = mapping.get(account.id, 0)

Back to entity