添加功能

This commit is contained in:
李鹏宇
2026-09-01 16:26:23 +08:00
parent 93154ddc20
commit b7b0546f63
+13 -13
View File
@@ -232,11 +232,11 @@ class HrLeave(models.Model):
if holiday.request_hour_from and holiday.request_hour_to:
start_hour = float(holiday.request_hour_from)
end_hour = float(holiday.request_hour_to)
# if start_hour == 9 and end_hour == 12: # 谁知道客户那边怎么弄的 有这个需要 这个时候又要改回来
# holiday.number_of_hours = 4
# else:
hour = end_hour - start_hour
holiday.number_of_hours = hour
if start_hour == 9 and end_hour == 12:
holiday.number_of_hours = 4
else:
hour = end_hour - start_hour
holiday.number_of_hours = hour
else:
holiday.number_of_hours = 0
@@ -265,14 +265,14 @@ 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:
# 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
if start_hour == 9 and end_hour == 12:
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
else:
self.leave_hours = 0