diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index 4ca3f374c..98cd7c1e5 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -318,6 +318,20 @@ class YuthonVacationReports(models.Model): self_meal = rec.meal_fee_ids.filtered(lambda o: not o.workflow_record_id and o.text == '上月额度继承') self_meal.update_lines = rec.remain_missed_meals + add_overtime_lines = rec.overtime_ids.filtered( + lambda o: o.text != '上月额度继承' and o.update_type == 'add' and o.is_void != True) + # 计算补休新增总天数 + workday_overtime_add = sum((line.workday or 0) for line in add_overtime_lines) / 8 + holidays_overtime_add = sum((line.public_holidays or 0) for line in add_overtime_lines) / 8 + rec.this_year1 += workday_overtime_add + holidays_overtime_add + rec.year_workday += workday_overtime_add + rec.year_holiday += holidays_overtime_add + # 计算年假新增总天数 + add_leave_lines = rec.leave_ids.filtered( + lambda o: o.text != '上月额度继承' and o.update_type == 'add' and o.is_void != True) + dynamic_remainder_year = sum((line.update_lines or 0) for line in add_leave_lines) / 8 + rec.dynamic_remainder_year += dynamic_remainder_year + valid_leave_lines = rec.leave_ids.filtered( lambda l: l.workflow_record_id and l.update_type == 'reduce' and l.is_void != True ) @@ -366,19 +380,6 @@ class YuthonVacationReports(models.Model): rec.used_this_year1 += deduct_from_current1 # 累加到本年已休 remaining_overtime_deduct -= deduct_from_current1 - add_overtime_lines = rec.overtime_ids.filtered(lambda o: o.text != '上月额度继承' and o.update_type == 'add' and o.is_void != True) - # 计算补休新增总天数 - workday_overtime_add = sum((line.workday or 0) for line in add_overtime_lines) / 8 - holidays_overtime_add = sum((line.public_holidays or 0) for line in add_overtime_lines) / 8 - rec.this_year1 += workday_overtime_add + holidays_overtime_add - rec.year_workday += workday_overtime_add - rec.year_holiday += holidays_overtime_add - # 计算年假新增总天数 - add_leave_lines = rec.leave_ids.filtered( - lambda o: o.text != '上月额度继承' and o.update_type == 'add' and o.is_void != True) - dynamic_remainder_year = sum((line.update_lines or 0) for line in add_leave_lines) / 8 - rec.dynamic_remainder_year += dynamic_remainder_year - rec._compute_leave() rec._compute_meal_fee() rec._compute_working_overtime()