feat: ResignationSerializer create bug
This commit is contained in:
parent
e9d8402cda
commit
2dbd7da2f8
|
|
@ -326,3 +326,13 @@ class ResignationSerializer(CustomModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Resignation
|
model = Resignation
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
employee:Employee = validated_data['employee']
|
||||||
|
if employee.job_state == Employee.JOB_ON:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise ParseError('员工不在职,不可创建申请')
|
||||||
|
if Resignation.objects.filter(employee=employee).exists():
|
||||||
|
raise ParseError('该员工已存在离职申请')
|
||||||
|
return super().create(validated_data)
|
||||||
Loading…
Reference in New Issue