!4378 添加功能

Merge pull request !4378 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-08-07 07:17:30 +00:00
committed by Gitee
+4 -5
View File
@@ -558,7 +558,7 @@ class HolidaysRequestBatch(models.Model):
# 查找关联的假期额度记录
report_month = date(period_start.year, period_start.month, 1)
vacation_report = self.env['yuthon.vacation.reports'].search([
('employee_id', '=', self.users_id.employee_id.id),
('employee_id', '=', self.users_id.employee_ids.id),
('vacation_date', '>=', fields.Date.to_string(report_month)),
('vacation_date', '<=', fields.Date.to_string(
date(period_start.year, period_start.month,
@@ -569,14 +569,13 @@ class HolidaysRequestBatch(models.Model):
self.env['vacation.other.line'].create({
'vacation_id': vacation_report.id if vacation_report else False,
'holiday_type': leave_data['type_id'].id,
'employee_id': self.users_id.employee_id.id,
'employee_id': self.users_id.employee_ids.id,
'workflow_record_id': leave_data['workflow_id'],
'update_date': fields.Date.today(),
'update_type': 'reduce',
'lines': days,
'text': f"请假审批"
})
_logger.info(f"成功创建非年假明细记录(类型:{leave_type_name}),天数为{days}天,员工ID为{self.users_id.employee_id.id}")
def _get_day_leaves(self, leave_type_name):
workflow_id = self.env['soong.workflow.record'].search([('code', '=', self.code)], limit=1).id
@@ -633,7 +632,7 @@ class HolidaysRequestBatch(models.Model):
"""更新年假记录"""
report_month = date(period_start.year, period_start.month, 1)
vacation_report = self.env['yuthon.vacation.reports'].search([
('employee_id', '=', self.users_id.employee_id.id),
('employee_id', '=', self.users_id.employee_ids.id),
('vacation_date', '>=', fields.Date.to_string(report_month)),
('vacation_date', '<=', fields.Date.to_string(
date(period_start.year, period_start.month,
@@ -643,7 +642,7 @@ class HolidaysRequestBatch(models.Model):
# 创建年假明细记录
self.env['vacation.leave.line'].create({
'vacation_id': vacation_report.id if vacation_report else False,
'employee_id': self.users_id.employee_id.id,
'employee_id': self.users_id.employee_ids.id,
'workflow_record_id': leave_data['workflow_id'],
'update_type': 'reduce',
'update_date': fields.Date.today(),