[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
This commit is contained in:
parent
a7ff1104bc
commit
2442fe2e4b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue