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

Module: Resource

Entity: resource.calendar

Compute Method: _compute_hours_per_week

Inputs Method Outputs
""" Compute the average hours per week """
for calendar in self:
            # see _compute_days_per_week: variable/undefined calendars are set directly by the user
            if calendar.calendar_type != 'fixed':
                continue
            attendances = calendar.attendance_ids.filtered(lambda a: a._is_work_period())
            calendar.hours_per_week = sum(attendances.mapped('duration_hours'))

Back to entity