!7561 添加功能

Merge pull request !7561 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-01-04 09:05:24 +00:00
committed by Gitee
3 changed files with 26 additions and 6 deletions
@@ -190,6 +190,16 @@ class HrLeaveAllocation(models.Model):
if leave.holiday_status_id.name == '年假':
current_leave_hours = leave.number_of_days * 8
existing_leave_line = False
if reports_id and reports_id.leave_ids:
existing_leave_line = reports_id.leave_ids.filtered(
lambda l: l.text == '上月额度继承'
)[:1]
if existing_leave_line:
update_leave_vals = {
'valid_date': leave.date_to,
}
existing_leave_line.write(update_leave_vals)
leave_list.append([0, 0, {
'vacation_id': reports_id.id,
'update_type': 'add',
@@ -317,16 +317,24 @@ class OvertimeApprovals(models.Model):
})
reports_id.write({'meal_fee_ids': [meal_fee_value]})
# 查找下个月的记录 如果有的话 加到本年剩余(补休)里面
# 查找下个月的记录 如果有的话 加到明细的上月继承额度里面
start_date = fields.Date.to_date(self.start_time) + relativedelta(months=1)
vacation_next_date = start_date.replace(day=1)
reports_next_id = self.env['yuthon.vacation.reports'].search([
('employee_id', '=', employee_id.id),
('vacation_date', '=', vacation_next_date)
])
if reports_next_id:
reports_next_id.year_workday += record.duration / 8
existing_line = self.env['vacation.over.line'].search([
('vacation_id', '=', reports_next_id.id),
('employee_id', '=', reports_next_id.employee_id.id),
('text', '=', '上月额度继承'),
], limit=1)
if existing_line:
existing_line.write({
'workday': workday,
'legal_day': legal_day,
'public_holidays': public_holidays,
})
start_date = fields.Date.to_date(self.start_time)
end_date = fields.Date.to_date(self.end_time)
attendance_records = self.env['hr.attendance'].search([
@@ -688,12 +688,13 @@ class YuthonVacationReports(models.Model):
total_add1 = 0.0
total_add2 = 0.0
total_add = 0.0
legal_total = 0.0
for line in record.overtime_ids:
if line.is_void:
continue
line_total = (line.workday or 0) + (line.legal_day or 0) + (line.public_holidays or 0)
line_total = (line.workday or 0) + (line.public_holidays or 0) + (line.legal_day or 0)
legal_total += (line.legal_day or 0)
if line.update_type == 'add':
total_add += line_total
elif line.update_type == 'reduce':
@@ -710,6 +711,7 @@ class YuthonVacationReports(models.Model):
record.working_overtime = max(total_add / 8, 0) + adjust_holiday_days
record.done_working_overtime = total_add1 / 8
record.legal_total = legal_total/8
record.cop_leave = total_add2 / 8
@api.depends('meal_fee_ids.update_lines', 'meal_fee_ids.update_type', 'meal_fee_ids.is_void')