|
|
for attendance in self:
if not attendance.recurrency:
attendance.recurrency_until = attendance.date
continue
match attendance.recurrency_end_type:
case 'date' if attendance.recurrency_until == date.max:
attendance.recurrency_until = date.today()
case 'times' if attendance.date and attendance.recurrency_type and attendance.recurrency_interval and attendance.recurrency_count:
attendance.recurrency_until = attendance.date + timedelta(**{attendance.recurrency_type: attendance.recurrency_interval * (attendance.recurrency_count - 1)})
case 'forever':
attendance.recurrency_until = date.max
|
|