Browse Source

[FIX] beesdoo_shift: Next countdown infinite loop

pull/140/head
Rémy Taymans 5 years ago
parent
commit
3df4d3980e
  1. 2
      beesdoo_shift/__openerp__.py
  2. 30
      beesdoo_shift/models/cooperative_status.py

2
beesdoo_shift/__openerp__.py

@ -13,7 +13,7 @@
'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Cooperative management',
'version': '9.0.1.3.0',
'version': '9.0.1.3.1',
'depends': ['beesdoo_base', 'barcodes'],

30
beesdoo_shift/models/cooperative_status.py

@ -151,17 +151,23 @@ class CooperativeStatus(models.Model):
rec.irregular_start_date, date
)
# Check holidays
if (rec.holiday_start_time and 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):
and date <= rec.holiday_end_time
):
date = add_days_delta(date, 1)
continue
# Check temporary exemption
elif (rec.temporary_exempt_start_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):
and date <= rec.temporary_exempt_end_date
):
date = add_days_delta(date, 1)
continue
else:
# Otherwise
counter -= 1
date = add_days_delta(date, 1)
rec.future_alert_date = self._next_countdown_date(
@ -195,19 +201,23 @@ 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
if (
rec.holiday_start_time and rec.holiday_end_time
and date >= rec.holiday_start_time
and date <= rec.holiday_end_time):
and date <= rec.holiday_end_time
):
date = add_days_delta(date, 1)
continue
# Check temporary exemption
elif (rec.temporary_exempt_start_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):
and date <= rec.temporary_exempt_end_date
):
date = add_days_delta(date, 1)
continue
else:
# Otherwise
next_countdown_date = date
rec.next_countdown_date = next_countdown_date

Loading…
Cancel
Save