From 2442fe2e4b9b44b984d0552e16be2d1e19ca7d29 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 14 Sep 2015 10:24:48 +0200 Subject: [PATCH] [FIX] resource: hour_to and hour_from in interval_get_multi The function interval_get_multi must take into account the minutes in hour_from and hour_to. hour_to and hour_from are float fields in the model "resource.calendar.attendance" and the decimal part of these two fields is for the minutes. opw:648349 --- addons/resource/resource.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/resource/resource.py b/addons/resource/resource.py index 155d6ab4c68..ec414f2f38a 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -165,8 +165,10 @@ class resource_calendar(osv.osv): current_hour = dt_from.hour while float_compare(todo, 0, 4) and maxrecur: for (hour_from,hour_to) in [(item['hour_from'], item['hour_to']) for item in hours_by_cal[id] if item['dayofweek'] == str(dt_from.weekday())]: - hour_from = dt_from.replace(hour=int(hour_from)).replace(tzinfo=tzinfo).astimezone(pytz.UTC).hour - hour_to = dt_from.replace(hour=int(hour_to)).replace(tzinfo=tzinfo).astimezone(pytz.UTC).hour + h_from = dt_from.replace(hour=int(hour_from), minute=int((hour_from % 1)*60)).replace(tzinfo=tzinfo).astimezone(pytz.UTC) + hour_from = h_from.hour + f_round(float(h_from.minute)/60, 2) + h_to = dt_from.replace(hour=int(hour_to), minute=int((hour_to % 1)*60)).replace(tzinfo=tzinfo).astimezone(pytz.UTC) + hour_to = h_to.hour + f_round(float(h_to.minute)/60, 2) leave_flag = False if (hour_to>current_hour) and float_compare(todo, 0, 4): m = max(hour_from, current_hour)