[Erp5-report] r40403 kazuhiko - in /erp5/trunk/products/ERP5: mixin/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Nov 19 11:13:56 CET 2010


Author: kazuhiko
Date: Fri Nov 19 11:13:56 2010
New Revision: 40403

URL: http://svn.erp5.org?rev=40403&view=rev
Log:
fix the problem : when we invoke an alarm manually, alarm table record is reset.

Modified:
    erp5/trunk/products/ERP5/mixin/periodicity.py
    erp5/trunk/products/ERP5/tests/testAlarm.py

Modified: erp5/trunk/products/ERP5/mixin/periodicity.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/periodicity.py?rev=40403&r1=40402&r2=40403&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/periodicity.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/periodicity.py [utf8] Fri Nov 19 11:13:56 2010
@@ -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

Modified: erp5/trunk/products/ERP5/tests/testAlarm.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAlarm.py?rev=40403&r1=40402&r2=40403&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAlarm.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAlarm.py [utf8] Fri Nov 19 11:13:56 2010
@@ -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




More information about the Erp5-report mailing list