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
49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
from django.apps import AppConfig
|
|
|
|
from horilla_automations.signals import start_automation
|
|
|
|
|
|
class HorillaAutomationConfig(AppConfig):
|
|
default_auto_field = "django.db.models.BigAutoField"
|
|
name = "horilla_automations"
|
|
|
|
def ready(self) -> None:
|
|
ready = super().ready()
|
|
try:
|
|
|
|
from base.templatetags.horillafilters import app_installed
|
|
from employee.models import Employee
|
|
from horilla_automations.methods.methods import get_related_models
|
|
from horilla_automations.models import MODEL_CHOICES
|
|
|
|
recruitment_installed = False
|
|
if app_installed("recruitment"):
|
|
recruitment_installed = True
|
|
|
|
models = [Employee]
|
|
if recruitment_installed:
|
|
from recruitment.models import Candidate
|
|
|
|
models.append(Candidate)
|
|
|
|
main_models = models
|
|
for main_model in main_models:
|
|
related_models = get_related_models(main_model)
|
|
|
|
for model in related_models:
|
|
path = f"{model.__module__}.{model.__name__}"
|
|
MODEL_CHOICES.append((path, model.__name__))
|
|
MODEL_CHOICES.append(("employee.models.Employee", "Employee"))
|
|
MODEL_CHOICES = list(set(MODEL_CHOICES))
|
|
try:
|
|
start_automation()
|
|
except:
|
|
"""
|
|
Migrations are not affected yet
|
|
"""
|
|
except:
|
|
"""
|
|
Models not ready yet
|
|
"""
|
|
return ready
|