[UPDT] PAYROLL: Update contract creation signals for employee

This commit is contained in:
Horilla
2025-04-05 14:34:23 +05:30
parent c6a5c0e9a1
commit f2c17aa283
3 changed files with 14 additions and 10 deletions

View File

@@ -32,16 +32,18 @@ def _clear_bulk_employees_cache(queryset):
@receiver(post_save, sender=EmployeeWorkInformation)
def monitor_employee_update(sender, instance, created, **kwargs):
"""
This method to track employee instance update
This method tracks updates to an employee's work information instance.
"""
_sender = sender
_created = created
cache_keys = ACCESSIBILITY_CACHE_USER_KEYS.copy().get(
instance.employee_id.employee_user_id.id, []
)
for key in cache_keys:
cache.delete(key)
if instance.employee_id and instance.employee_id.employee_user_id:
user_id = instance.employee_id.employee_user_id.id
cache_keys = ACCESSIBILITY_CACHE_USER_KEYS.get(user_id, [])
for key in cache_keys:
cache.delete(key)
@receiver(post_save, sender=DefaultAccessibility)

View File

@@ -15,7 +15,9 @@ def employeeworkinformation_pre_save(sender, instance, **_kwargs):
This method is used to override the save method for EmployeeWorkInformation Model
"""
active_employee = (
instance.employee_id if instance.employee_id.is_active == True else None
instance.employee_id
if instance.employee_id and instance.employee_id.is_active == True
else None
)
if active_employee is not None:
all_contracts = Contract.objects.entire()

View File

@@ -114,8 +114,8 @@
</div>
<script src="{% static '/build/js/web.frontend.min.js' %}"></script>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<!-- <script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> -->
{% comment %} <script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> {% endcomment %}
<script type="module" src="{% static 'images/ionicons/ui_icons/ionicons/ionicons.esm.js' %}"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
<script>
@@ -132,4 +132,4 @@
</script>
</body>
</html>
</html>