[FIX] RECRUITMENT: Bypassing survey from application form for recruitment managers and stage managers

This commit is contained in:
Horilla
2024-09-05 23:26:39 +05:30
parent b02bb8e24e
commit 1a48c55aee

View File

@@ -342,7 +342,15 @@ def application_form(request):
if RecruitmentSurvey.objects.filter(
recruitment_ids=recruitment_id
).exists():
if not request.user.has_perm("perms.recruitment.add_candidate"):
try:
employee = request.user.employee_get
if (
not request.user.has_perm("perms.recruitment.add_candidate")
or employee not in recruitment.recruitment_managers.all()
or not employee.stage_set.filter(recruitment_id=recruitment)
):
return redirect(candidate_survey)
except:
return redirect(candidate_survey)
candidate_obj.save()