!12350 添加功能

Merge pull request !12350 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-07-07 03:25:14 +00:00
committed by Gitee
2 changed files with 33 additions and 1 deletions
@@ -4,6 +4,7 @@ from datetime import datetime, time, timedelta
from odoo.exceptions import UserError
from odoo.exceptions import ValidationError, UserError
import calendar
from dateutil.relativedelta import relativedelta
class GoApprovalsLine(models.Model):
@@ -321,6 +322,20 @@ class GoApprovals(models.Model):
('vacation_date', '=', month_first)
], limit=1)
# 如果当月考勤确认单已确认,则将数据加到下个月的确认单
if reports_id and reports_id.vacation_state == 'confirmed':
next_month_first = month_first + relativedelta(months=1)
reports_id = self.env['yuthon.vacation.reports'].search([
('employee_id', '=', self.users_id.employee_ids.id),
('vacation_date', '=', next_month_first)
], limit=1)
if not reports_id:
reports_id = self.env['yuthon.vacation.reports'].create({
'employee_id': self.users_id.employee_ids.id,
'vacation_date': next_month_first,
})
reports_id.vacation_state = 'not_sent'
if not reports_id:
continue
@@ -416,7 +416,6 @@ class OvertimeApprovals(models.Model):
else:
start_date = datetime(start_year, 1, 1).date()
valid_date = False
meal_number = employee_id.meal_number
if self.meal == 'yes':
meal_number += 1
@@ -430,6 +429,21 @@ class OvertimeApprovals(models.Model):
('employee_id', '=', employee_id.id),
('vacation_date', '=', vacation_date)
])
# 如果当月考勤确认单已确认,则将数据加到下个月的确认单
if reports_id and reports_id.vacation_state == 'confirmed':
next_month_date = vacation_date + relativedelta(months=1)
reports_id = self.env['yuthon.vacation.reports'].search([
('employee_id', '=', employee_id.id),
('vacation_date', '=', next_month_date)
], limit=1)
if not reports_id:
reports_id = self.env['yuthon.vacation.reports'].create({
'employee_id': employee_id.id,
'vacation_date': next_month_date,
})
reports_id.vacation_state = 'not_sent'
workflow_record_id = self.env['soong.workflow.record'].search([
('code', '=', self.code),
('reclaim_state', '=', False)
@@ -498,6 +512,9 @@ class OvertimeApprovals(models.Model):
})
reports_id.write({'meal_fee_ids': [meal_fee_value]})
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([