diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index 47819ac68..d338d0aa0 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -502,22 +502,26 @@ class YuthonVacationReports(models.Model): 'overtime_ids.legal_day', 'overtime_ids.public_holidays', 'overtime_ids.update_type', - 'overtime_ids.is_void' + 'overtime_ids.is_void', 'overtime_ids.workflow_record_id' ) def _compute_working_overtime(self): for record in self: - total_add = 0.0 total_add1 = 0.0 + total_add = 0.0 + for line in record.overtime_ids: - if not line.is_void: - line_total = (line.workday or 0) + (line.legal_day or 0) + (line.public_holidays or 0) - if line.update_type == 'add' and line.workflow_record_id: - total_add += line_total - else: - total_add += line_total - record.working_overtime = max(total_add / 8, 0) - record.done_working_overtime = total_add1 / 8 + if line.is_void: + continue + + line_total = (line.workday or 0) + (line.legal_day or 0) + (line.public_holidays or 0) + total_add += line_total + + if line.workflow_record_id and line.update_type == 'add': + total_add1 += line_total + + record.working_overtime = max(total_add / 8, 0) # 所有有效明细行总额 + record.done_working_overtime = total_add1 / 8 # 符合条件的明细行总额 record.cop_leave = total_add1 / 8 @api.depends('meal_fee_ids.update_lines', 'meal_fee_ids.update_type', 'meal_fee_ids.is_void')