添加功能
This commit is contained in:
@@ -236,6 +236,9 @@ class HrLeave(models.Model):
|
||||
holiday.number_of_hours = 4
|
||||
else:
|
||||
hour = end_hour - start_hour
|
||||
# 跨中午(12:00-13:00 午休),减去1小时
|
||||
if start_hour < 13 and end_hour > 12:
|
||||
hour -= 1
|
||||
holiday.number_of_hours = hour
|
||||
else:
|
||||
holiday.number_of_hours = 0
|
||||
@@ -268,7 +271,11 @@ class HrLeave(models.Model):
|
||||
if start_hour == 9 and end_hour in [13, 14]:
|
||||
self.leave_hours = 4
|
||||
else:
|
||||
self.leave_hours = end_hour - start_hour
|
||||
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
|
||||
|
||||
@@ -538,8 +545,7 @@ class HolidaysRequestBatch(models.Model):
|
||||
hourly_records = []
|
||||
for line in self.hour_leave_ids:
|
||||
if line.holiday_status_id.name == leave_type_name and line.request_date_from:
|
||||
hours_match = re.search(r'(\d+(?:\.\d+)?)', line.number_of_hours_text or '')
|
||||
hours = float(hours_match.group(1)) if hours_match else 0
|
||||
hours = line.leave_hours
|
||||
hourly_records.append({
|
||||
'leave_id': line.id,
|
||||
'date': fields.Date.from_string(line.request_date_from),
|
||||
|
||||
Reference in New Issue
Block a user