Commit d23c2a26 authored by Sebastien Robin's avatar Sebastien Robin

erp5_calendar: make sure to take into account start and stop date of assignment

parent 2e617f64
...@@ -40,11 +40,16 @@ class GroupCalendarAssignment(PresencePeriod): ...@@ -40,11 +40,16 @@ class GroupCalendarAssignment(PresencePeriod):
def _getDatePeriodDataList(self): def _getDatePeriodDataList(self):
result = [] result = []
start_date = self.getStartDate()
stop_date = self.getStopDate()
group_calendar = self.getSpecialiseValue() group_calendar = self.getSpecialiseValue()
if not(None in (self.getDestinationUid(), group_calendar)): if not(None in (self.getDestinationUid(), group_calendar, start_date,
stop_date)):
presence_period_list = group_calendar.objectValues( presence_period_list = group_calendar.objectValues(
portal_type="Group Presence Period") portal_type="Group Presence Period")
for presence_period in presence_period_list: for presence_period in presence_period_list:
result.extend(presence_period._getDatePeriodDataList()) for date_period_data in presence_period._getDatePeriodDataList():
if date_period_data['start_date'].greaterThanEqualTo(start_date) and \
date_period_data['stop_date'].lessThanEqualTo(stop_date):
result.append(date_period_data)
return result return result
\ No newline at end of file
385 386
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment