This commit is contained in:
李鹏宇
2026-04-15 11:31:36 +08:00
parent 8dc455219f
commit b6f73fb185
+1 -2
View File
@@ -58,13 +58,12 @@ class GoApprovals(models.Model):
if not rec.start_date or not rec.end_date or not rec.employee_ids:
continue
for employee in rec.employee_ids:
# 查找同一员工其他外出申请中时间段有交叉的记录(排除自身,排除已撤销的)
# 查找同一员工其他外出申请中时间段有交叉的记录(排除自身,active=False即撤销的自动被排除)
overlapping = self.env['go.approval'].search([
('id', '!=', rec.id),
('employee_ids', 'in', employee.id),
('start_date', '<=', rec.end_date),
('end_date', '>=', rec.start_date),
('reclaim_state', '=', False),
])
if overlapping:
raise ValidationError(