+ From 2fee7c18bb7209bce80b30e1de3094a7946b72a1 Mon Sep 17 00:00:00 2001 From: Horilla <131998600+horilla-opensource@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:22:44 +0530 Subject: [PATCH] [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 --- asset/apps.py | 10 + asset/forms.py | 3 + asset/models.py | 4 +- asset/static/src/asset/dashboard.js | 3 +- asset/templates/asset/asset_information.html | 2 +- asset/templates/asset/asset_return_form.html | 141 +- asset/templates/asset_history/group_by.html | 2 +- .../request_allocation/group_by.html | 2 +- asset/urls.py | 16 + asset/views.py | 102 +- attendance/admin.py | 5 +- attendance/apps.py | 10 + attendance/filters.py | 12 +- attendance/forms.py | 67 +- attendance/methods/utils.py | 476 ++++ attendance/models.py | 549 +++-- attendance/sidebar.py | 9 + attendance/static/attendance/actions.js | 2 +- .../static/dashboard/attendanceChart.js | 79 +- .../attendance/dashboard/dashboard.html | 2 +- .../attendance/dashboard/overtime_table.html | 4 +- .../dashboard/to_validate_table.html | 2 +- .../grace_time/grace_time_table.html | 2 +- .../late_come_early_out/group_by.html | 6 +- .../late_come_early_out/report_list.html | 6 +- .../late_come_early_out/single_report.html | 4 +- .../templates/attendance/penalty/form.html | 206 +- .../work_record/work_record_create.html | 16 + .../work_record_employees_view.html | 74 + .../work_record/work_record_view copy.html | 37 + .../attendance/attendance_comment.html | 2 +- .../requests/attendance/comment_view.html | 4 +- attendance/urls.py | 100 +- attendance/views.py | 131 +- attendance/views/clock_in_out.py | 16 +- attendance/views/dashboard.py | 154 +- attendance/views/penalty.py | 47 +- attendance/views/requests.py | 17 +- attendance/views/search.py | 4 +- attendance/views/views.py | 569 +++-- base/admin.py | 6 + base/context_processors.py | 44 +- base/filters.py | 119 +- base/forms.py | 203 +- base/methods.py | 248 ++- base/migrations/__init__.py | 144 ++ base/models.py | 203 +- base/request_and_approve.py | 153 +- base/scheduler.py | 25 +- base/static/holiday/action.js | 384 ++++ .../announcement/announcement_one.html | 6 +- base/templates/announcement/comment_view.html | 4 +- base/templates/base/general_settings.html | 18 +- .../base/rotating_shift/htmx/group_by.html | 2 +- .../rotating_work_type/htmx/group_by.html | 2 +- base/templates/common_form.html | 49 + .../company_leave/company_leave.html | 127 ++ .../company_leave_creation_form.html | 56 + .../company_leave_update_form.html | 58 + .../company_leave/company_leave_view.html | 100 + base/templates/holiday/holiday.html | 262 +++ .../holiday/holiday_export_filter_form.html | 78 + base/templates/holiday/holiday_filter.html | 45 + base/templates/holiday/holiday_form.html | 70 + .../holiday/holiday_update_form.html | 63 + base/templates/holiday/holiday_view.html | 297 +++ base/templates/horilla_form.html | 56 + base/templates/mail/empty_mail_template.html | 89 + base/templates/mail/htmx/form.html | 65 + base/templates/mail/view_templates.html | 109 + .../condition_table.html | 8 +- base/templates/penalty/penalty_view.html | 42 + .../asset_requests_approve.html | 4 +- .../attendance_validate.html | 4 +- .../request_and_approve/feedback_answer.html | 4 +- .../leave_allocation_approve.html | 4 +- .../leave_request_approve.html | 4 +- .../request_and_approve/overtime_approve.html | 4 +- .../request_and_approve/shift_request.html | 4 +- .../work_type_request.html | 4 +- .../htmx/allocation_details.html | 2 +- .../htmx/allocation_requests.html | 2 +- .../shift_request/htmx/comment_view.html | 4 +- .../shift_request/htmx/group_by.html | 2 +- .../shift_request/htmx/requests.html | 2 +- .../shift_request/htmx/shift_comment.html | 2 +- .../htmx/shift_request_detail.html | 2 +- .../shift_request/request_update_form.html | 2 +- .../shift_request/shift_request.html | 2 +- .../shift_request/shift_request_export.html | 2 +- .../shift_request/shift_request_view.html | 2 +- .../work_type_request/htmx/comment_view.html | 4 +- .../work_type_request/htmx/group_by.html | 2 +- .../work_type_request/htmx/requests.html | 2 +- .../htmx/work_type_comment.html | 2 +- .../htmx/work_type_request_single_view.html | 2 +- .../request_update_form.html | 2 +- base/templatetags/basefilters.py | 33 +- base/templatetags/horillafilters.py | 288 +++ base/urls.py | 197 +- base/views.py | 1100 +++++---- employee/filters.py | 76 +- employee/forms.py | 17 + employee/models.py | 131 +- employee/not_in_out_dashboard.py | 8 +- employee/templates/dashboard/not_in_yet.html | 4 +- employee/templates/dashboard/not_out_yet.html | 3 +- .../dashboard/upcoming_birthdays.html | 2 +- .../disciplinary_nav.html | 10 - .../disciplinary_records.html | 2 +- .../documents/document_requests.html | 2 +- employee/templates/documents/requests.html | 2 +- .../dashboard/dashboard_employee.html | 4 +- .../employee/profile/profile_view.html | 353 ++- .../employee/update_form/work_details.html | 8 +- .../templates/employee/view/individual.html | 872 ++++---- .../templates/employee_export_filter.html | 213 +- employee/templates/employee_nav.html | 47 +- .../employee_personal_info/bulk_update.html | 4 +- .../employee_personal_info/employee_card.html | 16 +- .../employee_personal_info.html | 149 +- .../employee_update_form.html | 2 +- .../employee_personal_info/group_by.html | 2 +- .../employee_personal_info/script.js | 2 +- .../employee_personal_info/style.css | 2 +- employee/templates/import_export_nav.html | 2 +- employee/templates/policies/form.html | 27 +- employee/templates/policies/nav.html | 12 +- employee/templates/policies/records.html | 4 +- employee/templates/policies/view_policy.html | 21 +- .../tabs/allowance_deduction-tab.html | 2 +- employee/templates/tabs/attendance-tab.html | 6 +- employee/templates/tabs/contract-tab.html | 6 +- employee/templates/tabs/htmx/view_file.html | 2 +- employee/templates/tabs/leave-tab.html | 6 +- employee/templates/tabs/penalty_account.html | 4 +- employee/templates/tabs/personal-tab.html | 296 +-- .../templates/tabs/scheduled_interview.html | 2 +- employee/templates/tabs/shift-tab.html | 4 +- employee/urls.py | 42 +- employee/views.py | 521 ++--- helpdesk/apps.py | 10 + helpdesk/forms.py | 4 +- .../templates/helpdesk/faq/faq_list_view.html | 5 +- .../helpdesk/ticket/ticket_form.html | 17 +- .../helpdesk/ticket/ticket_group.html | 2 +- .../helpdesk/ticket/ticket_view.html | 3 +- helpdesk/urls.py | 17 + helpdesk/views.py | 95 + horilla/config.py | 69 +- horilla/decorators.py | 1 - horilla/filters.py | 66 +- horilla/horilla_apps.py | 6 +- horilla/methods.py | 45 + horilla/models.py | 49 +- horilla/settings.py | 90 +- horilla/signals.py | 2 +- horilla/urls.py | 10 - .../horilla_audit/history_tracking.html | 10 +- .../horilla_audit/horilla_audit_log.html | 94 +- horilla_automations/apps.py | 15 +- horilla_automations/methods/methods.py | 20 +- horilla_automations/models.py | 11 +- horilla_automations/signals.py | 1 + horilla_crumbs/context_processors.py | 11 +- horilla_documents/models.py | 31 +- horilla_views/admin.py | 12 +- horilla_views/cbv_methods.py | 75 +- horilla_views/forms.py | 41 - horilla_views/generic/cbv/views.py | 311 +-- horilla_views/models.py | 35 - .../templates/generic/filter_tags.html | 21 +- horilla_views/templates/generic/form.html | 36 +- horilla_views/templates/generic/group_by.html | 56 +- .../templates/generic/horilla_card.html | 50 +- .../generic/horilla_detailed_view.html | 10 +- .../templates/generic/horilla_form.html | 4 +- .../templates/generic/horilla_list.html | 55 +- .../templates/generic/horilla_nav.html | 13 +- .../templates/generic/horilla_tabs.html | 6 +- .../templatetags/generic_template_filters.py | 45 +- horilla_views/urls.py | 16 - horilla_views/views.py | 91 +- leave/admin.py | 7 +- leave/apps.py | 10 + leave/filters.py | 244 +- leave/forms.py | 346 ++- leave/methods.py | 93 +- leave/migrations/__init__.py | 8 - leave/models.py | 233 +- leave/scheduler.py | 22 - leave/sidebar.py | 14 +- leave/static/dashboard/dashboard.js | 939 ++++---- .../compensatory_leave_comment.html | 6 +- leave/templates/leave/dashboard.html | 2 +- leave/templates/leave/employee_dashboard.html | 2 +- .../comment_view.html | 4 +- .../leave_allocation_comment.html | 2 +- .../leave_allocation_request_group_by.html | 2 +- .../leave_allocation_request_single_view.html | 4 +- .../leave/leave_assign/group_by.html | 2 +- .../leave_assign/single_assign_view.html | 2 +- .../leave/leave_request/comment_view.html | 4 +- .../dashboard_leave_requests.html | 2 +- .../leave/leave_request/group_by.html | 14 +- .../leave/leave_request/leave_comment.html | 2 +- .../leave_request/leave_request_form.html | 117 +- .../leave/leave_request/leave_requests.html | 24 +- .../leave/leave_request/one_request_view.html | 2 +- .../leave_request/request_update_form.html | 118 +- .../leave_type_individual_view.html | 2 +- .../templates/leave/user_leave/group_by.html | 2 +- .../leave/user_leave/request_form.html | 118 +- .../leave/user_leave/user_leave.html | 2 +- .../leave/user_leave/user_request_form.html | 122 +- .../leave/user_leave/user_request_update.html | 118 +- leave/urls.py | 225 +- leave/views.py | 1981 ++++++++--------- offboarding/apps.py | 10 + offboarding/forms.py | 53 - offboarding/models.py | 14 +- .../offboarding/note/view_notes.html | 2 +- .../offboarding/resignation/request_list.html | 2 +- .../offboarding/task/table_body.html | 2 +- offboarding/views.py | 50 +- onboarding/apps.py | 10 + onboarding/forms.py | 3 + onboarding/static/dashboard/onboardChart.js | 51 - .../static/onboarding_view/dashboard.js | 216 +- .../onboarding/dashboard/task_report.html | 4 +- onboarding/urls.py | 5 - onboarding/views.py | 53 +- payroll/admin.py | 3 +- payroll/apps.py | 7 + payroll/forms/component_forms.py | 43 +- payroll/forms/forms.py | 15 - payroll/methods/methods.py | 280 +-- payroll/methods/payslip_calc.py | 29 +- payroll/models/models.py | 350 +-- payroll/static/payroll/action.js | 2 +- payroll/static/payroll/dashboard.js | 102 +- .../templates/payroll/contract/group_by.html | 2 +- payroll/templates/payroll/dashboard.html | 2 +- .../payroll/payslip/create_payslip.html | 25 - .../payroll/payslip/view_payslips.html | 9 +- .../payroll/reimbursement/comment_view.html | 4 +- .../reimbursement/reimbursement_comment.html | 2 +- .../reimbursement/reimbursement_list.html | 5 +- .../payroll/reimbursement/request_cards.html | 5 +- payroll/urls/component_urls.py | 5 - payroll/urls/urls.py | 6 - payroll/views/component_views.py | 70 +- payroll/views/views.py | 69 - payroll/widgets/component_widgets.py | 16 +- pms/apps.py | 10 + pms/forms.py | 9 +- pms/models.py | 2 +- pms/templates/okr/key_result/kr_card.html | 3 +- pms/templates/okr/key_result/kr_list.html | 2 +- pms/templates/okr/key_result/view_kr.html | 2 +- pms/templatetags/pmsfilters.py | 29 + pms/urls.py | 6 + pms/views.py | 82 +- recruitment/admin.py | 2 - recruitment/apps.py | 10 + recruitment/forms.py | 106 +- .../static/dashboard/recruitmentChart.js | 51 + .../templates/candidate/application_form.html | 10 +- .../templates/candidate/candidate_card.html | 50 +- .../templates/candidate/candidate_list.html | 36 +- .../candidate/candidate_update_form.html | 2 +- recruitment/templates/candidate/group_by.html | 36 +- .../templates/candidate/individual.html | 6 +- recruitment/templates/candidate/success.html | 2 +- .../dashboard/candidates_per_stage.html | 2 +- .../templates/dashboard/dashboard.html | 208 +- .../components/candidate_stage_component.html | 28 +- .../candidate_kanban_components.html | 46 +- .../templates/pipeline/pipeline_card.html | 46 +- .../pipeline_components/add_note.html | 2 +- .../pipeline_components/view_note.html | 2 +- .../templates/pipeline/pipeline_empty.html | 2 +- .../templates/pipeline/pipeline_tab.html | 2 +- .../recruitment/recruitment_form.html | 2 +- recruitment/templates/select2.js | 2 +- recruitment/templates/stage/nav.html | 2 +- .../question_template_organized_form.html | 2 +- .../survey/view_single_template.html | 25 +- .../templatetags/recruitmentfilters.py | 10 +- recruitment/urls.py | 52 +- recruitment/views/actions.py | 23 + recruitment/views/mail_templates.py | 99 +- recruitment/views/surveys.py | 33 +- recruitment/views/views.py | 91 +- recruitment/widgets.py | 6 +- static/build/css/style.min.css | 4 +- static/build/js/htmxSelect2.js | 61 +- templates/404.html | 2 +- templates/405.html | 2 +- templates/dashboard.html | 1818 +++++++-------- templates/floating_button.html | 67 +- templates/index.html | 155 +- templates/navbar.html | 2 +- templates/no_perm.html | 2 +- templates/reset_send.html | 2 +- templates/settings.html | 225 +- templates/sidebar.html | 18 +- templates/went_wrong.html | 2 +- 308 files changed, 12414 insertions(+), 9577 deletions(-) create mode 100644 attendance/methods/utils.py create mode 100644 attendance/templates/attendance/work_record/work_record_create.html create mode 100644 attendance/templates/attendance/work_record/work_record_employees_view.html create mode 100644 attendance/templates/attendance/work_record/work_record_view copy.html create mode 100644 base/static/holiday/action.js create mode 100644 base/templates/common_form.html create mode 100644 base/templates/company_leave/company_leave.html create mode 100644 base/templates/company_leave/company_leave_creation_form.html create mode 100644 base/templates/company_leave/company_leave_update_form.html create mode 100644 base/templates/company_leave/company_leave_view.html create mode 100644 base/templates/holiday/holiday.html create mode 100644 base/templates/holiday/holiday_export_filter_form.html create mode 100644 base/templates/holiday/holiday_filter.html create mode 100644 base/templates/holiday/holiday_form.html create mode 100644 base/templates/holiday/holiday_update_form.html create mode 100644 base/templates/holiday/holiday_view.html create mode 100644 base/templates/horilla_form.html create mode 100644 base/templates/mail/empty_mail_template.html create mode 100644 base/templates/mail/htmx/form.html create mode 100644 base/templates/mail/view_templates.html create mode 100644 base/templates/penalty/penalty_view.html create mode 100644 base/templatetags/horillafilters.py create mode 100644 horilla/methods.py diff --git a/asset/apps.py b/asset/apps.py index 9c0c19427..ab042f3bc 100644 --- a/asset/apps.py +++ b/asset/apps.py @@ -18,3 +18,13 @@ class AssetConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "asset" + + def ready(self): + from django.urls import include, path + + from horilla.urls import urlpatterns + + urlpatterns.append( + path("asset/", include("asset.urls")), + ) + super().ready() diff --git a/asset/forms.py b/asset/forms.py index 9faa18f57..652ebb33c 100644 --- a/asset/forms.py +++ b/asset/forms.py @@ -411,6 +411,9 @@ class AssetReturnForm(ModelForm): } def __init__(self, *args, **kwargs): + """ + Initializes the AssetReturnForm with initial values and custom field settings. + """ super(AssetReturnForm, self).__init__(*args, **kwargs) self.fields["return_date"].initial = date.today() diff --git a/asset/models.py b/asset/models.py index eeb871d36..fcd31a8c6 100644 --- a/asset/models.py +++ b/asset/models.py @@ -210,7 +210,9 @@ class AssetRequest(HorillaModel): null=False, blank=False, ) - asset_category_id = models.ForeignKey(AssetCategory, on_delete=models.PROTECT) + asset_category_id = models.ForeignKey( + AssetCategory, on_delete=models.PROTECT, verbose_name=_("Asset Category") + ) asset_request_date = models.DateField(auto_now_add=True) description = models.TextField(null=True, blank=True, max_length=255) asset_request_status = models.CharField( diff --git a/asset/static/src/asset/dashboard.js b/asset/static/src/asset/dashboard.js index 6d6452ed7..c8179c278 100644 --- a/asset/static/src/asset/dashboard.js +++ b/asset/static/src/asset/dashboard.js @@ -1,3 +1,4 @@ +staticUrl = $("#statiUrl").attr("data-url"); $(document).ready(function() { function available_asset_chart(dataSet) { var Asset_available_chart = document.getElementById("assetAvailableChart"); @@ -83,7 +84,7 @@ function emptyAssetAvialabeChart(assetAvailableChartChart,args,options){ var noDataImage = new Image(); noDataImage.src = assetAvailableChartChart.data.emptyImageSrc ? assetAvailableChartChart.data.emptyImageSrc - : "/static/images/ui/joiningchart.png"; + : staticUrl +"images/ui/joiningchart.png"; message = assetAvailableChartChart.data.message ? assetAvailableChartChart.data.message diff --git a/asset/templates/asset/asset_information.html b/asset/templates/asset/asset_information.html index 74954c715..542da05b9 100644 --- a/asset/templates/asset/asset_information.html +++ b/asset/templates/asset/asset_information.html @@ -117,4 +117,4 @@ - + diff --git a/asset/templates/asset/asset_return_form.html b/asset/templates/asset/asset_return_form.html index b7d80cec0..0a8a2c2b9 100644 --- a/asset/templates/asset/asset_return_form.html +++ b/asset/templates/asset/asset_return_form.html @@ -1,60 +1,89 @@ -{% load i18n %} +{% load i18n %} {% load horillafilters %}
+
+