diff --git a/product/ERP5/Document/PresencePeriod.py b/product/ERP5/Document/PresencePeriod.py index a13db8b74d0f27f38f6bdd23fcba29c6f3dd3403..07c56572943cf2cfd0e61384a85e1f1c44eca194 100644 --- a/product/ERP5/Document/PresencePeriod.py +++ b/product/ERP5/Document/PresencePeriod.py @@ -143,7 +143,7 @@ class PresencePeriod(Movement, PeriodicityMixin): stop_date = self.getStopDate(start_date) periodicity_stop_date = self.getPeriodicityStopDate( start_date) - duration = stop_date - start_date + second_duration = int(stop_date) - int(start_date) # First date has to respect the periodicity config next_start_date = self.getNextPeriodicalDate(start_date-1) while (next_start_date is not None) and \ @@ -163,7 +163,8 @@ class PresencePeriod(Movement, PeriodicityMixin): (current_exception_date < next_start_date.Date()): # SQL method don't like iterator # yield (next_start_date, next_start_date+duration) - result.append([next_start_date, next_start_date+duration]) + result.append([next_start_date, + addToDate(next_start_date, second=second_duration)]) # Update the next exception date if len(exception_date_list) != 0: current_exception_date = exception_date_list.pop(0).Date() @@ -172,7 +173,8 @@ class PresencePeriod(Movement, PeriodicityMixin): else: # SQL method don't like iterator # yield (next_start_date, next_start_date+duration) - result.append([next_start_date, next_start_date+duration]) + result.append([next_start_date, + addToDate(next_start_date, second=second_duration)]) next_start_date = self.getNextPeriodicalDate(next_start_date) return result