Browse Source

Merge pull request #140 from beescoop/9.0-fix-shift-nextcoundown

[FIX] beesdoo_shift: Next countdown infinite loop
9.0 12.0-2020-06-26.00
Rémy Taymans 5 years ago
committed by GitHub
parent
commit
f246aae0eb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beesdoo_shift/__openerp__.py
  2. 46
      beesdoo_shift/models/cooperative_status.py

2
beesdoo_shift/__openerp__.py

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

46
beesdoo_shift/models/cooperative_status.py

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

Loading…
Cancel
Save