Files
ihrm/base/context_processors.py

302 lines
9.1 KiB
Python
Raw Normal View History

2023-12-01 15:36:51 +05:30
"""
context_processor.py
This module is used to register context processor`
"""
import re
[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
from django.apps import apps
from django.contrib import messages
2023-12-01 15:36:51 +05:30
from django.http import HttpResponse
from django.urls import path, reverse
from django.utils.translation import gettext_lazy as _
from base.models import Company, TrackLateComeEarlyOut
2023-12-01 15:36:51 +05:30
from base.urls import urlpatterns
from employee.models import (
Employee,
EmployeeGeneralSetting,
EmployeeWorkInformation,
ProfileEditFeature,
)
2024-05-23 14:29:29 +05:30
from horilla import horilla_apps
from horilla.decorators import hx_request_required, login_required, permission_required
[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
from horilla.methods import get_horilla_model_class
2023-12-01 15:36:51 +05:30
class AllCompany:
"""
Dummy class
"""
class Urls:
url = "https://ui-avatars.com/api/?name=All+Company&background=random"
company = "All Company"
icon = Urls()
text = "All companies"
id = None
def get_last_section(path):
# Remove any trailing slash and split the path
segments = path.strip("/").split("/")
# Get the last section (the ID)
last_section = segments[-1] if segments else None
return last_section
2023-12-01 15:36:51 +05:30
def get_companies(request):
"""
This method will return the history additional field form
"""
companies = list(
[company.id, company.company, company.icon.url, False]
for company in Company.objects.all()
)
companies = [
[
"all",
"All Company",
"https://ui-avatars.com/api/?name=All+Company&background=random",
False,
],
] + companies
selected_company = request.session.get("selected_company")
company_selected = False
if selected_company and selected_company == "all":
companies[0][3] = True
company_selected = True
else:
for company in companies:
if str(company[0]) == selected_company:
company[3] = True
company_selected = True
return {"all_companies": companies, "company_selected": company_selected}
@login_required
@hx_request_required
@permission_required("base.change_company")
2023-12-01 15:36:51 +05:30
def update_selected_company(request):
"""
This method is used to update the selected company on the session
"""
company_id = request.GET.get("company_id")
user = request.user.employee_get
user_company = getattr(
getattr(user, "employee_work_info", None), "company_id", None
)
2023-12-01 15:36:51 +05:30
request.session["selected_company"] = company_id
company = (
AllCompany()
if company_id == "all"
else (
Company.objects.filter(id=company_id).first()
if Company.objects.filter(id=company_id).first()
else AllCompany()
)
)
previous_path = request.GET.get("next", "/")
# Define the regex pattern for the path
pattern = r"^/employee/employee-view/\d+/$"
# Check if the previous path matches the pattern
if company_id != "all":
if re.match(pattern, previous_path):
employee_id = get_last_section(previous_path)
employee = Employee.objects.filter(id=employee_id).first()
emp_company = getattr(
getattr(employee, "employee_work_info", None), "company_id", None
)
if emp_company != company:
text = "Other Company"
if company_id == user_company:
text = "My Company"
company = {
"company": company.company,
"icon": company.icon.url,
"text": text,
"id": company.id,
}
messages.error(
request, _("Employee is not working in the selected company.")
)
request.session["selected_company_instance"] = company
return HttpResponse(
f"""
<script>window.location.href = `{reverse("employee-view")}`</script>
"""
)
2023-12-01 15:36:51 +05:30
if company_id == "all":
text = "All companies"
elif company_id == user_company:
text = "My Company"
else:
text = "Other Company"
2023-12-01 15:36:51 +05:30
company = {
"company": company.company,
"icon": company.icon.url,
"text": text,
"id": company.id,
}
request.session["selected_company_instance"] = company
return HttpResponse("<script>window.location.reload();</script>")
urlpatterns.append(
path(
"update-selected-company",
update_selected_company,
name="update-selected-company",
)
)
2024-01-25 16:36:49 +05:30
2024-05-23 14:29:29 +05:30
def white_labelling_company(request):
white_labelling = getattr(horilla_apps, "WHITE_LABELLING", False)
if white_labelling:
hq = Company.objects.filter(hq=True).last()
try:
company = (
request.user.employee_get.get_company()
if request.user.employee_get.get_company()
else hq
)
except:
company = hq
return {
"white_label_company_name": company.company if company else "Horilla",
"white_label_company": company,
}
else:
return {
"white_label_company_name": "Horilla",
"white_label_company": None,
}
2024-01-25 16:36:49 +05:30
def resignation_request_enabled(request):
"""
Check weather resignation_request enabled of not in offboarding
"""
enabled_resignation_request = False
[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
first = None
if apps.is_installed("offboarding"):
OffboardingGeneralSetting = get_horilla_model_class(
app_label="offboarding", model="offboardinggeneralsetting"
)
first = OffboardingGeneralSetting.objects.first()
2024-01-25 16:36:49 +05:30
if first:
enabled_resignation_request = first.resignation_request
return {"enabled_resignation_request": enabled_resignation_request}
def timerunner_enabled(request):
"""
Check weather resignation_request enabled of not in offboarding
"""
[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
first = None
enabled_timerunner = True
[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
if apps.is_installed("attendance"):
AttendanceGeneralSetting = get_horilla_model_class(
app_label="attendance", model="attendancegeneralsetting"
)
first = AttendanceGeneralSetting.objects.first()
if first:
enabled_timerunner = first.time_runner
return {"enabled_timerunner": enabled_timerunner}
def intial_notice_period(request):
"""
Check weather resignation_request enabled of not in offboarding
"""
initial = 30
[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
first = None
if apps.is_installed("payroll"):
PayrollGeneralSetting = get_horilla_model_class(
app_label="payroll", model="payrollgeneralsetting"
)
first = PayrollGeneralSetting.objects.first()
if first:
initial = first.notice_period
return {"get_initial_notice_period": initial}
def check_candidate_self_tracking(request):
"""
This method is used to get the candidate self tracking is enabled or not
"""
[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
candidate_self_tracking = False
[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
if apps.is_installed("recruitment"):
RecruitmentGeneralSetting = get_horilla_model_class(
app_label="recruitment", model="recruitmentgeneralsetting"
)
first = RecruitmentGeneralSetting.objects.first()
else:
first = None
if first:
candidate_self_tracking = first.candidate_self_tracking
return {"check_candidate_self_tracking": candidate_self_tracking}
def check_candidate_self_tracking_rating(request):
"""
This method is used to check enabled/disabled of rating option
"""
rating_option = False
[IMP] Remove inter module dependency (#274) This commit introduces significant changes to the architecture of the Horilla HRMS system by decoupling interdependent modules. The following modifications were made: 1. **Module Independence**: Each module has been refactored to eliminate reliance on other modules, promoting a more modular and maintainable codebase. 2. **Refactored Imports and Dependencies**: Adjusted import statements and dependency injections to support independent module operation. 3. **Compatibility and Functionality**: Ensured that all modules are compatible with existing systems and maintain their intended functionality both independently and when integrated with other modules. These changes enhance the modularity, maintainability, and scalability of the Horilla HRMS, allowing developers to work on individual modules without affecting the entire system. Future development and deployment will be more efficient and less prone to issues arising from tightly coupled code. **NOTE** For existing Horilla users, if you face any issues during the migrations, please run the following command and try again the migrations. - `python3 manage.py makemigrations` - `python3 manage.py migrate base` - `python3 manage.py migrate` * [IMP] ASSET: Asset module dependency removal from other Horilla apps * [IMP] ATTENDANCE: Attendance module dependency removal from other Horilla apps * [IMP] BASE: Base module dependency removal from other Horilla apps * [IMP] EMPLOYEE: Employee module dependency removal from other Horilla apps * [IMP] HELPDESK: Helpdesk module dependency removal from other Horilla apps * [IMP] HORILLA AUDIT: Horilla Audit module dependency removal from other Horilla apps * [IMP] HORILLA CRUMBS: Horilla Crumbs module dependency removal from other Horilla apps * [IMP] HORILLA AUTOMATIONS: Horilla Automations module dependency removal from other Horilla apps * [IMP] HORILLA VIEWS: Horilla Views module dependency removal from other Horilla apps * [IMP] LEAVE: Leave module dependency removal from other Horilla apps * [IMP] OFFBOARDING: Offboarding module dependency removal from other Horilla apps * [IMP] ONBOARDING: Onboarding module dependency removal from other Horilla apps * [IMP] PMS: PMS module dependency removal from other Horilla apps * [IMP] PAYROLL: Payroll module dependency removal from other Horilla apps * [IMP] RECRUITMENT: Recruitment module dependency removal from other Horilla apps * [IMP] HORILLA: Dependency removal updates * [IMP] TEMPLATES: Dependency removal updates * [IMP] STATIC: Dependency removal updates * [IMP] HORILLA DOCUMENTS: Horilla Documents module dependency removal from other Horilla apps * [ADD] HORILLA: methods.py * [UPDT] HORILLA: Settings.py * [FIX] EMPLOYEE: About tab issue * Update horilla_settings.py * Remove dummy db init password
2024-08-05 14:22:44 +05:30
if apps.is_installed("recruitment"):
RecruitmentGeneralSetting = get_horilla_model_class(
app_label="recruitment", model="recruitmentgeneralsetting"
)
first = RecruitmentGeneralSetting.objects.first()
else:
first = None
if first:
rating_option = first.show_overall_rating
return {"check_candidate_self_tracking_rating": rating_option}
def get_initial_prefix(request):
"""
This method is used to get the initial prefix
"""
settings = EmployeeGeneralSetting.objects.first()
instance_id = None
prefix = "PEP"
if settings:
instance_id = settings.id
prefix = settings.badge_id_prefix
return {"get_initial_prefix": prefix, "prefix_instance_id": instance_id}
def biometric_app_exists(request):
from django.conf import settings
biometric_app_exists = "biometric" in settings.INSTALLED_APPS
return {"biometric_app_exists": biometric_app_exists}
def enable_late_come_early_out_tracking(request):
tracking = TrackLateComeEarlyOut.objects.first()
enable = tracking.is_enable if tracking else True
return {"tracking": enable, "late_come_early_out_tracking": enable}
def enable_profile_edit(request):
from accessibility.accessibility import ACCESSBILITY_FEATURE
profile_edit = ProfileEditFeature.objects.filter().first()
Dev/v2.0 (#977) * [FIX] BASE: Fixed the permissions in the settings page and updated the payroll permission * [FIX] DOCKER: Issue with creating migration file for auth user model * [FIX] EMPLOYEE : Document request view toggle issue fixes * [FIX] ATTENDANCE: Fixed union of distinct querysets in attendance request * [FIX] PAYROLL: Fixed reimbursement form excluded field issue * [UPDT] WHATSAPP: Updated flow json version * [UPDT] WHATSAPP: Updated meta_token from charfield to text field * [UPDT] WHATSAPP: Updated whatsapp credential view url to CBV template view * [FIX] WHATSAPP: Fixed issues in sending messages and added exception message if request failed * [UPDT] RECRUITMENT: Formatted recruitment view page * [UPDT] RECRUITMENT: Updated linkedin to check for integration enabled * [FIX] SETTINGS: Fixed outlook issue on settings page * [FIX] SETTINGS: Fixed outlook error in settings page * [RMV] GENERAL: Remove unwanted console log messages * [UPDT] HORILLA_THEME: Updated permission for ldap and Gmeet in settings page * [RMV] GENERAL: Remove unwanted console log messages * [UPDT] BASE: Index page updation * [UPDT] WHATSAPP: Add whatsapp app to the installed_apps list * [FIX] BASE: Fixed the permission issue in the general settings section * [FIX] WHATSAPP: Fixed decorator issue and test message exception issue * [RMV] GENERAL: Remove unwanted print statements * [FIX] SETTINGS: Fixed typo in permission for Outlook * [IMP] Remove formatting of migrations file from the pre-commit hooks * [RMV] BASE: Unwanted variable from the chart * [FIX] Fix the regex issue with exclusion of migrations files in the pre-commit config * [FIX] EMPLOYEE: #964 * [FIX] EMPLOYEE: Employee import in v2 * [FIX] ATTENDANCE: Error handling for attendance out time initial setup * [FIX] HORILLA_VIEWS: Fixed generic import modal id * [UPDT] HORILLA_THEME: Updated login button styling and load database modal close button issue * [FIX] HORILLA_THEME: Updated permission for linkedin in settings * [FIX] HORILLA: Fixed import of app from base to django.apps * [FIX] SETTINGS: Fixed outlook error in settings page * [FIX] BASE: Restrict own records of employee profile edit fixes * [FIX] LEAVE: Query optimization * [FIX] BASE: Fixed database hit before apps loaded in company manager * [UPDT] BASE: Moved EmployeeShiftDay creation logic from app ready() function to post_migrate signal * [FIX] HELPDESK: Moved clean method from models to form and updated days remailning showing for resolved tickets (#949) * [FIX] STYLE: Fixed yellow and yellowgreen row status color * [UPDT] BASE: Added template tag for verbose name * [FIX] BASE: General settings permission fixes * [FIX] EMPLOYEE: Document request issue fixes while rejecting the document request * [UPDT] PAYROLL: Updated filing status model * [UPDT] NOTIFICATIONS: Updated notification model class Meta * [UPDT] BASE: Updated form and company manager to prevent database call when django loading * [UPDT] ONBOARDING: Fixed db hit on server loading * [UPDT] PAYROLL: Fixed db hit on server loading * [UPDT] PMS: Fixed db hit on server loading * [UPDT] RECRUITMENT: Fixed db hit on server loading * [FIX] OUTLOOK_AUTH: Fixed emaillog not showing for outlook emails (#959) * [FIX] GENERIC: Fixed form submission issue when a validation error occured * [FIX] ONBOARDING: Fixed filter instance in onboarding pipeline nav * [FIX] RECRUITMENT: Fixed linkedIn error when creating recruitment(#973) * [UPDT] Avoid formatting the __init__.py files from the migrations folder during pre-commit hook
2025-11-07 14:38:56 +05:30
enable = False if profile_edit and profile_edit.is_enabled else True
if enable:
if not any(item[0] == "profile_edit" for item in ACCESSBILITY_FEATURE):
ACCESSBILITY_FEATURE.append(("profile_edit", _("Profile Edit Access")))
return {"profile_edit_enabled": enable}