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

Module: Employee Calendar Planning

Entity: resource.calendar

Compute Method: _compute_full_time_required_hours

Inputs Method Outputs
"""The value of full_time_required_hours is defined unless the calendar is
        auto_generate; in that case, the hours for the applicable calendars will
        be defined based on the dates specified by context.
        """
for item in self:
            hours = item.stored_full_time_required_hours
            if item.auto_generate and item.flexible_hours:
                from_date = self.env.context.get("flexible_hours_from_date")
                to_date = self.env.context.get("flexible_hours_to_date")
                employee = fields.first(item.employee_ids)
                if (from_date or to_date) and employee:
                    calendars = employee._get_planning_calendars(from_date, to_date)
                    hours = (
                        (
                            sum(
                                c.stored_full_time_required_hours
                                for c in calendars.calendar_id
                            )
                        )
                        if calendars
                        else False
                    )
            item.full_time_required_hours = hours

Back to entity