|
|
@ -151,18 +151,24 @@ class CooperativeStatus(models.Model): |
|
|
|
rec.irregular_start_date, date |
|
|
|
) |
|
|
|
# Check holidays |
|
|
|
if (rec.holiday_start_time and rec.holiday_end_time |
|
|
|
and date >= rec.holiday_start_time |
|
|
|
and date <= rec.holiday_end_time): |
|
|
|
if ( |
|
|
|
rec.holiday_start_time and rec.holiday_end_time |
|
|
|
and date >= rec.holiday_start_time |
|
|
|
and date <= rec.holiday_end_time |
|
|
|
): |
|
|
|
date = add_days_delta(date, 1) |
|
|
|
continue |
|
|
|
# Check temporary exemption |
|
|
|
elif (rec.temporary_exempt_start_date |
|
|
|
and rec.temporary_exempt_end_date |
|
|
|
and date >= rec.temporary_exempt_start_date |
|
|
|
and date <= rec.temporary_exempt_end_date): |
|
|
|
if ( |
|
|
|
rec.temporary_exempt_start_date |
|
|
|
and rec.temporary_exempt_end_date |
|
|
|
and date >= rec.temporary_exempt_start_date |
|
|
|
and date <= rec.temporary_exempt_end_date |
|
|
|
): |
|
|
|
date = add_days_delta(date, 1) |
|
|
|
continue |
|
|
|
else: |
|
|
|
counter -= 1 |
|
|
|
# Otherwise |
|
|
|
counter -= 1 |
|
|
|
date = add_days_delta(date, 1) |
|
|
|
rec.future_alert_date = self._next_countdown_date( |
|
|
|
rec.irregular_start_date, date |
|
|
@ -195,20 +201,24 @@ class CooperativeStatus(models.Model): |
|
|
|
while not next_countdown_date: |
|
|
|
date = self._next_countdown_date(rec.irregular_start_date, date) |
|
|
|
# Check holidays |
|
|
|
if (rec.holiday_start_time and rec.holiday_end_time |
|
|
|
and date >= rec.holiday_start_time |
|
|
|
and date <= rec.holiday_end_time): |
|
|
|
if ( |
|
|
|
rec.holiday_start_time and rec.holiday_end_time |
|
|
|
and date >= rec.holiday_start_time |
|
|
|
and date <= rec.holiday_end_time |
|
|
|
): |
|
|
|
date = add_days_delta(date, 1) |
|
|
|
continue |
|
|
|
# Check temporary exemption |
|
|
|
elif (rec.temporary_exempt_start_date |
|
|
|
and rec.temporary_exempt_end_date |
|
|
|
and date >= rec.temporary_exempt_start_date |
|
|
|
and date <= rec.temporary_exempt_end_date): |
|
|
|
if ( |
|
|
|
rec.temporary_exempt_start_date |
|
|
|
and rec.temporary_exempt_end_date |
|
|
|
and date >= rec.temporary_exempt_start_date |
|
|
|
and date <= rec.temporary_exempt_end_date |
|
|
|
): |
|
|
|
date = add_days_delta(date, 1) |
|
|
|
continue |
|
|
|
else: |
|
|
|
next_countdown_date = date |
|
|
|
# Otherwise |
|
|
|
next_countdown_date = date |
|
|
|
rec.next_countdown_date = next_countdown_date |
|
|
|
|
|
|
|
@api.constrains("working_mode", "irregular_start_date") |
|
|
|