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_day

View 19.0 View 20.0
Inputs Method Outputs
  • days_per_week
  • hours_per_week
- """ Compute the average hours per day.
-             Cannot directly depend on hours_per_week because of rounding issues. """
- for calendar in self.filtered(lambda c: not c.flexible_hours):
-             calendar.hours_per_day = float_round(calendar._get_hours_per_day(), precision_digits=2)
+ for calendar in self:
+             calendar.hours_per_day = calendar.hours_per_week / calendar.days_per_week if calendar.days_per_week else 0
  • hours_per_day

Back to entity