添加功能

This commit is contained in:
李鹏宇
2026-03-17 21:38:30 +08:00
parent e5adb8019f
commit 365bb03b1b
2 changed files with 20 additions and 5 deletions
@@ -62,7 +62,6 @@ class ExtendedVacationApproval(models.Model):
if self.employee_ids:
has_annual_leave = self.type_vacations_ids.filtered(lambda r: r.name == '年假')
has_overtime_leave = self.type_vacations_ids.filtered(lambda r: r.name == '补休')
for employee in self.employee_ids:
report_records = self.env['yuthon.vacation.reports'].search([
('employee_id', '=', employee.id),
@@ -377,17 +377,33 @@ class YuthonVacationReports(models.Model):
rec.year_workday += workday_overtime_add
rec.year_holiday += holidays_overtime_add
if (rec.dynamic_previous_year1 + rec.this_year1) > 0:
current_month_first = rec.vacation_date.replace(day=1)
last_month_last = current_month_first - timedelta(days=1)
last_month_first = last_month_last.replace(day=1)
last_month_record = self.env['yuthon.vacation.reports'].search([
('employee_id', '=', rec.employee_id.id),
('vacation_date', '=', last_month_first),
], limit=1)
if last_month_record:
total_overtime = last_month_record.dynamic_previous_year1 + last_month_record.this_year1
else:
total_overtime = 0.0
if total_overtime > 0:
working_overtime_lines = rec.overtime_ids.filtered(
lambda o: not o.workflow_record_id and o.text == '上月额度继承'
)
working_overtime_lines.workday = (rec.dynamic_previous_year1 + rec.this_year1) * 8
working_overtime_lines.workday = total_overtime * 8
if last_month_record:
total_leave = last_month_record.dynamic_previous_year + last_month_record.dynamic_remainder_year
else:
total_leave = 0.0
if (rec.dynamic_previous_year + rec.dynamic_remainder_year) > 0:
if total_leave > 0:
leave_lines = rec.leave_ids.filtered(
lambda o: not o.workflow_record_id and o.text == '上月额度继承'
)
leave_lines.update_lines = (rec.dynamic_previous_year + rec.dynamic_remainder_year) * 8
leave_lines.update_lines = total_leave * 8
rec._compute_leave()
rec._compute_working_overtime()