[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:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user