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_attendance_ids

View 19.0 View 20.0
Inputs Method Outputs
  • company_id
  • company_id.resource_calendar_id
  • id
  • calendar_type
  • attendance_ids
- for calendar in self.filtered(lambda c: not c._origin or (c._origin.company_id != c.company_id and c.company_id)):
-             company_calendar = calendar.company_id.resource_calendar_id
-             calendar.update({
-                 'two_weeks_calendar': company_calendar.two_weeks_calendar,
-                 'tz': company_calendar.tz,
-                 'attendance_ids': [(5, 0, 0)] + [
-                     (0, 0, attendance._copy_attendance_vals()) for attendance in company_calendar.attendance_ids],
-             })
+ for calendar in self:
+             calendar_changed = calendar._origin and calendar._origin.company_id != calendar.company_id
+             if (not calendar.id or calendar_changed) and calendar.calendar_type == "fixed" and not calendar.attendance_ids:
+                 calendar.attendance_ids = calendar._get_default_attendance_ids(calendar.company_id)
  • attendance_ids

Back to entity