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

Module: HR Gamification

Entity: gamification.badge

Compute Method: _compute_granted_employees_count

Inputs Method Outputs
user_count = dict(
            self.env['gamification.badge.user']._read_group(
                [('badge_id', 'in', self.ids), ('employee_id', '!=', False)],
                ['badge_id'], ['__count'],
            ),
        )
for badge in self:
            badge.granted_employees_count = user_count.get(badge._origin, 0)

Back to entity