@@ -265,14 +265,10 @@ class HrLeave(models.Model):
|
||||
if self.request_hour_from and self.request_hour_to:
|
||||
start_hour = float(self.request_hour_from)
|
||||
end_hour = float(self.request_hour_to)
|
||||
if start_hour == 9 and end_hour == 12:
|
||||
if start_hour == 9 and end_hour in [13, 14]:
|
||||
self.leave_hours = 4
|
||||
else:
|
||||
leave_hours = end_hour - start_hour
|
||||
# 跨中午(12:00-13:00 午休),减去1小时
|
||||
if start_hour < 13 and end_hour > 12:
|
||||
leave_hours -= 1
|
||||
self.leave_hours = leave_hours
|
||||
self.leave_hours = end_hour - start_hour
|
||||
else:
|
||||
self.leave_hours = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user