Files
ihrm/recruitment/methods.py
Nikhil Ravi Cybrosys 9d0d7a2230 [UPDT]summer note in recruitment (#9)
* [UPDT]candidate update stage

* [FIX]typo in notification - email sent

* [UPDT]recruitment updates

* [UPDT]onboarding updates

* [UPDT]attendance updates

* [UPDT]employee updates

* [UPDT]updated static files for summernote

---------

Co-authored-by: NIKHIL RAVI <nikhil.ravi10@gmail.com>
2023-06-06 12:27:41 +05:30

55 lines
1.4 KiB
Python

"""
methods.py
This page is used to write reusable methods.
"""
def is_stagemanager(request):
"""
This method is used to check stage manager, if the employee is also
recruitment manager it returns true
"""
try:
employee = request.user.employee_get
return employee.recruitment_set.exists() or employee.stage_set.exists()
except Exception:
return False
def is_recruitmentmanager(request):
"""
This method is used to check the employee is recruitment manager or not
"""
try:
employee = request.user.employee_get
return employee.recruitment_set.exists()
except Exception:
return False
def stage_manages(request, stage):
"""
This method is used to check the employee manager to this stage."""
try:
employee = request.user.employee_get
return (
stage.stage_manager.filter(id=employee.id).exists()
or stage.recruitment_id.recruitment_managers.filter(id=employee.id).exists()
)
except Exception:
return False
def recruitment_manages(request, recruitment):
"""
This method is used to check the employee is manager to the current recruitment
"""
try:
employee = request.user.employee_get
return recruitment.recruitment_managers.filter(id=employee.id).exists()
except Exception:
return False