[UPDT] BASE: Updated base app by changing ThreadLocalMiddleware location to horilla project folder
This commit is contained in:
@@ -17,7 +17,6 @@ from django.dispatch import receiver
|
||||
from django.utils.translation import gettext as _
|
||||
from django.utils.translation import gettext_lazy as trans
|
||||
|
||||
from base import thread_local_middleware
|
||||
from base.horilla_company_manager import HorillaCompanyManager
|
||||
from base.models import (
|
||||
Company,
|
||||
@@ -30,6 +29,7 @@ from base.models import (
|
||||
validate_time_format,
|
||||
)
|
||||
from employee.methods.duration_methods import format_time, strtime_seconds
|
||||
from horilla import horilla_middlewares
|
||||
from horilla.models import HorillaModel
|
||||
from horilla_audit.methods import get_diff
|
||||
from horilla_audit.models import HorillaAuditInfo, HorillaAuditLog
|
||||
@@ -351,7 +351,7 @@ class Employee(models.Model):
|
||||
"""
|
||||
from attendance.models import Attendance
|
||||
|
||||
request = getattr(thread_local_middleware._thread_locals, "request", None)
|
||||
request = getattr(horilla_middlewares._thread_locals, "request", None)
|
||||
if not getattr(request, "working_employees", None):
|
||||
today = datetime.now().date()
|
||||
yesterday = today - timedelta(days=1)
|
||||
@@ -414,7 +414,7 @@ class Employee(models.Model):
|
||||
# call the parent class's save method to save the object
|
||||
prev_employee = Employee.objects.filter(id=self.id).first()
|
||||
super().save(*args, **kwargs)
|
||||
request = getattr(thread_local_middleware._thread_locals, "request", None)
|
||||
request = getattr(horilla_middlewares._thread_locals, "request", None)
|
||||
if request and not self.is_active and self.get_archive_condition() is not False:
|
||||
self.is_active = True
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user