diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index fdcce548d..284304abf 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -1298,7 +1298,9 @@ class HrAttendance(models.Model): pass #todo 待过 def update_attendance(self, employee, current_date): - current_date_str = fields.Date.to_string(current_date) + if self.workflow_id: + if self.workflow_id.res_model == 'card.approval': + return current_date_start = datetime.combine(current_date, datetime.min.time()) # 当天 00:00:00 datetime类型 current_date_end = datetime.combine(current_date, datetime.max.time()) # 当天 23:59:59 datetime类型 @@ -1336,7 +1338,6 @@ class HrAttendance(models.Model): ('work_end', '=', True), ] go_approval_records = self.env['go.approval'].search(go_approval_domain) - match_record = False for go in go_approval_records: # 按天匹配 diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py index 6da57e0ba..154e2f170 100644 --- a/yuthon_hr_attendance/models/overtime_approval.py +++ b/yuthon_hr_attendance/models/overtime_approval.py @@ -259,10 +259,10 @@ class OvertimeApprovals(models.Model): if actual_start < base_start: total_overtime_seconds += (base_start - actual_start).total_seconds() if actual_end > base_end: - total_overtime_seconds += (actual_end - base_end).total_seconds() + real_overtime_start = max(base_end, actual_start) + total_overtime_seconds += (actual_end - real_overtime_start).total_seconds() else: total_overtime_seconds = (actual_end - actual_start).total_seconds() - original_hours = total_overtime_seconds / 3600 # 加班起步一小时 if original_hours < 1.0: