[FIX] resource: compute working hours of current day using only the current day

Tomorrow never dies; however no need to add its working hours today.
Indeed rrule until parameter is inclusive. This means that in
current implementation next day is included in computation. This commit
fixes that.
This commit is contained in:
Thibault Delavallée
2017-02-16 17:34:35 +01:00
parent 857593068e
commit 44971c2be1
+3 -2
View File
@@ -393,8 +393,9 @@ class ResourceCalendar(models.Model):
def get_working_hours(self, start_dt, end_dt, compute_leaves=False,
resource_id=None, default_interval=None):
hours = 0.0
for day in rrule.rrule(rrule.DAILY, dtstart=start_dt,
until=(end_dt + timedelta(days=1)).replace(hour=0, minute=0, second=0),
for day in rrule.rrule(rrule.DAILY,
dtstart=start_dt,
until=end_dt,
byweekday=self.get_weekdays()):
day_start_dt = day.replace(hour=0, minute=0, second=0)
if start_dt and day.date() == start_dt.date():