@@ -89,8 +89,6 @@ def _extra_hours_in_non_remurated_day(self):
8989 extra_hours = 0
9090 if self .worked_hours == 0 :
9191 extra_hours = self .hours_to_work * - 1
92- elif self .worked_hours <= self .hours_to_work :
93- extra_hours = self .worked_hours - self .hours_to_work
9492 else :
9593 extra_hours = self .worked_hours - self .hours_to_work
9694 return extra_hours
@@ -99,14 +97,12 @@ def _extra_hours_in_remurated_day(self):
9997 extra_hours = 0
10098 if self .worked_hours == 0 :
10199 extra_hours = (self .hours_to_work - self .remunerated_hours ) * - 1
102- elif self .worked_hours <= self .remunerated_hours :
103- extra_hours = (
104- self .hours_to_work - self .remunerated_hours + self .worked_hours
105- )
106100 else :
107- extra_hours = self .worked_hours - (
108- self .hours_to_work - self .remunerated_hours
109- )
101+ worked_hours = self .worked_hours + self .remunerated_hours
102+ if worked_hours >= self .hours_to_work :
103+ extra_hours = worked_hours - self .hours_to_work
104+ else :
105+ extra_hours = (self .hours_to_work - worked_hours ) * - 1
110106 return extra_hours
111107
112108 def _treat_employee_dates (self , employees_dates ):
@@ -239,10 +235,7 @@ def _get_leave(self, contract, work_date, vals):
239235 if leave :
240236 hours = vals .get ("hours_to_work" )
241237 if leave .holiday_status_id .request_unit != "day" :
242- difference = leave .date_to - leave .date_from
243- hours_difference = difference .total_seconds () / 3600
244- if hours_difference < hours :
245- hours = hours_difference
238+ hours = leave .number_of_hours
246239 vals ["leave_type_id" ] = leave .holiday_status_id .id
247240 vals ["day_type" ] = leave .holiday_status_id .name
248241 if leave .holiday_status_id .time_type == "other" :
0 commit comments