外出
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user