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

Module: Employees

Entity: resource.calendar

Compute Method: _compute_material_resources_count

Inputs Method Outputs
materials_per_calendar = dict(self.env['resource.resource']._read_group(
            domain=[
                ('resource_type', '=', 'material'),
                ('calendar_id', 'in', self.ids),
            ],
            groupby=['calendar_id'],
            aggregates=['__count'],
        ))
for calendar in self:
            calendar.material_resources_count = materials_per_calendar.get(calendar, 0)

Back to entity