diff --git a/product/ERP5/mixin/periodicity.py b/product/ERP5/mixin/periodicity.py index d5c9cf5963172dfb05fc5e5aa19653a42e9211cf..62e8ed56276ee4950e3f695d96c175fc7b5bde54 100644 --- a/product/ERP5/mixin/periodicity.py +++ b/product/ERP5/mixin/periodicity.py @@ -192,10 +192,11 @@ class PeriodicityMixin: periodicity_stop_date = self.getPeriodicityStopDate() if next_start_date is None: next_start_date = current_date - if next_start_date > current_date \ - or (periodicity_stop_date is not None \ - and next_start_date >= periodicity_stop_date): + if periodicity_stop_date is not None \ + and next_start_date >= periodicity_stop_date: return None + elif next_start_date > current_date: + return next_start_date timezone = self._getTimezone(next_start_date) previous_date = next_start_date diff --git a/product/ERP5/tests/testAlarm.py b/product/ERP5/tests/testAlarm.py index 3956571ce26c6e38037eefb0bd4a93e0b39aca26..1952632e048a086c7c1014b7a216a5c264f885cf 100644 --- a/product/ERP5/tests/testAlarm.py +++ b/product/ERP5/tests/testAlarm.py @@ -150,6 +150,9 @@ class TestAlarm(ERP5TypeTestCase): alarm.setNextAlarmDate(current_date=now) next_date = addToDate(next_date,hour=1) self.assertEquals(alarm.getAlarmDate(),next_date) + # check if manual invoking does not break getAlarmDate() result. + alarm.activeSense() + self.assertEquals(alarm.getAlarmDate(),next_date) def test_04_Every3Hours(self, quiet=0, run=run_all_test): if not run: return