Skip to content

Commit

Permalink
[FIX] beesdoo_shift: Next countdown infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
remytms committed Apr 7, 2020
1 parent 82cb43b commit 3df4d39
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion beesdoo_shift/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],

Expand Down
46 changes: 28 additions & 18 deletions beesdoo_shift/models/cooperative_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,24 @@ def _compute_future_alert_date(self):
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
Expand Down Expand Up @@ -195,20 +201,24 @@ def _compute_next_countdown_date(self):
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")
Expand Down

0 comments on commit 3df4d39

Please sign in to comment.