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.attendance

Compute Method: _compute_day_period

View 19.0 View 20.0
Inputs Method Outputs
  • duration_hours
  • calendar_id
  • calendar_id.hours_per_day
  • duration_based
  • hour_from
  • hour_to
+ for attendance in self:
+             if attendance.duration_hours > (0.75 * attendance.calendar_id.hours_per_day) or attendance.duration_based:
+                 attendance.day_period = 'full_day'
+             elif attendance.hour_from and attendance.hour_to:
+                 if attendance.hour_from > 12 or (12 - attendance.hour_from <= attendance.hour_to - 12):
+                     attendance.day_period = 'afternoon'
+                 else:
+                     attendance.day_period = 'morning'
+             else:
+                 attendance.day_period = 'morning'
  • day_period

Back to entity