From b7c3559173bb8b667ed8d77d5a2723652c99b508 Mon Sep 17 00:00:00 2001 From: Horilla Date: Thu, 4 Jul 2024 10:33:51 +0530 Subject: [PATCH] [FIX] BASE: Dependance order to extend employee model --- attendance/forms.py | 4 +++- base/horilla_company_manager.py | 4 ++-- employee/forms.py | 4 +++- horilla/config.py | 1 - horilla_automations/signals.py | 4 +++- payroll/forms/component_forms.py | 4 +++- pms/models.py | 2 -- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/attendance/forms.py b/attendance/forms.py index 368cc9c65..a0ec40bbc 100644 --- a/attendance/forms.py +++ b/attendance/forms.py @@ -23,6 +23,7 @@ class YourForm(forms.Form): import datetime import json +import logging import uuid from calendar import month_name from collections import OrderedDict @@ -56,13 +57,14 @@ from base.models import Company, EmployeeShift from employee.filters import EmployeeFilter from employee.models import Employee from horilla import horilla_middlewares -from horilla.decorators import logger from horilla_widgets.widgets.horilla_multi_select_field import HorillaMultiSelectField from horilla_widgets.widgets.select_widgets import HorillaMultiSelectWidget from leave.filters import LeaveRequestFilter from leave.models import LeaveType from payroll.methods.methods import get_working_days +logger = logging.getLogger(__name__) + class ModelForm(forms.ModelForm): """ diff --git a/base/horilla_company_manager.py b/base/horilla_company_manager.py index adcc95e54..b3734bcb8 100644 --- a/base/horilla_company_manager.py +++ b/base/horilla_company_manager.py @@ -2,7 +2,7 @@ horilla_company_manager.py """ -import threading +import logging from typing import Coroutine, Sequence from django.db import models @@ -11,6 +11,7 @@ from django.db.models.query import QuerySet from horilla.horilla_middlewares import _thread_locals from horilla.signals import post_bulk_update, pre_bulk_update +logger = logging.getLogger(__name__) django_filter_update = QuerySet.update @@ -46,7 +47,6 @@ class HorillaCompanyManager(models.Manager): """ get_queryset method """ - from horilla.decorators import logger queryset = super().get_queryset() request = getattr(_thread_locals, "request", None) diff --git a/employee/forms.py b/employee/forms.py index 5654cafcb..edb60555a 100644 --- a/employee/forms.py +++ b/employee/forms.py @@ -21,6 +21,7 @@ class YourForm(forms.Form): pass """ +import logging import re from datetime import date from typing import Any @@ -47,9 +48,10 @@ from employee.models import ( PolicyMultipleFile, ) from horilla import horilla_middlewares -from horilla.decorators import logger from horilla_audit.models import AccountBlockUnblock +logger = logging.getLogger(__name__) + class ModelForm(forms.ModelForm): """ diff --git a/horilla/config.py b/horilla/config.py index b73cb82ad..da8b24a45 100644 --- a/horilla/config.py +++ b/horilla/config.py @@ -6,7 +6,6 @@ Horilla app configurations import importlib import logging -import os from django.conf import settings from django.contrib.auth.context_processors import PermWrapper diff --git a/horilla_automations/signals.py b/horilla_automations/signals.py index 7412c3c06..78cd44e47 100644 --- a/horilla_automations/signals.py +++ b/horilla_automations/signals.py @@ -4,6 +4,7 @@ horilla_automation/signals.py """ import copy +import logging import threading import types @@ -17,6 +18,8 @@ from django.dispatch import receiver from horilla.horilla_middlewares import _thread_locals from horilla.signals import post_bulk_update, pre_bulk_update +logger = logging.getLogger(__name__) + @classmethod def from_list(cls, object_list): @@ -328,7 +331,6 @@ def send_mail(request, automation, instance): """ from base.backends import ConfiguredEmailBackend from base.methods import generate_pdf - from horilla.decorators import logger from horilla_automations.methods.methods import ( get_model_class, get_related_field_model, diff --git a/payroll/forms/component_forms.py b/payroll/forms/component_forms.py index 746fc4d23..7c38533cd 100644 --- a/payroll/forms/component_forms.py +++ b/payroll/forms/component_forms.py @@ -4,6 +4,7 @@ of form fields and widgets for the corresponding models in the payroll managemen """ import datetime +import logging import uuid from typing import Any @@ -17,7 +18,6 @@ from base.methods import reload_queryset from employee.filters import EmployeeFilter from employee.models import BonusPoint, Employee from horilla import horilla_middlewares -from horilla.decorators import logger from horilla_widgets.forms import HorillaForm from horilla_widgets.widgets.horilla_multi_select_field import HorillaMultiSelectField from horilla_widgets.widgets.select_widgets import HorillaMultiSelectWidget @@ -36,6 +36,8 @@ from payroll.models.models import ( ) from payroll.widgets import component_widgets as widget +logger = logging.getLogger(__name__) + class AllowanceForm(forms.ModelForm): """ diff --git a/pms/models.py b/pms/models.py index edf84785d..f93d3779a 100644 --- a/pms/models.py +++ b/pms/models.py @@ -714,8 +714,6 @@ class MeetingsAnswer(models.Model): def manipulate_existing_data(): from dateutil.relativedelta import relativedelta - from horilla.decorators import logger - try: for emp_objective in EmployeeObjective.objects.exclude(objective=None): objective, _ = Objective.objects.get_or_create(