[RMV] PAYROLL: Removed unwanted model OverrideWorkInfo

This commit is contained in:
Horilla
2025-01-06 16:20:59 +05:30
parent 9542567aec
commit 2689382aa0

View File

@@ -614,32 +614,33 @@ if apps.is_installed("leave"):
).delete() ).delete()
class OverrideWorkInfo(EmployeeWorkInformation): # class OverrideWorkInfo(EmployeeWorkInformation):
""" # """
This class is to override the Model default methods # This class is to override the Model default methods
""" # """
@receiver(pre_save, sender=EmployeeWorkInformation)
def employeeworkinformation_pre_save(sender, instance, **_kwargs): @receiver(pre_save, sender=EmployeeWorkInformation)
""" def employeeworkinformation_pre_save(sender, instance, **_kwargs):
This method is used to override the save method for EmployeeWorkInformation Model """
""" 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 active_employee = (
) instance.employee_id if instance.employee_id.is_active == True else None
if active_employee is not None: )
contract_exists = active_employee.contract_set.exists() if active_employee is not None:
if not contract_exists: contract_exists = active_employee.contract_set.exists()
contract = Contract() if not contract_exists:
contract.contract_name = f"{active_employee}'s Contract" contract = Contract()
contract.employee_id = active_employee contract.contract_name = f"{active_employee}'s Contract"
contract.contract_start_date = ( contract.employee_id = active_employee
instance.date_joining if instance.date_joining else datetime.today() contract.contract_start_date = (
) instance.date_joining if instance.date_joining else datetime.today()
contract.wage = ( )
instance.basic_salary if instance.basic_salary is not None else 0 contract.wage = (
) instance.basic_salary if instance.basic_salary is not None else 0
contract.save() )
contract.save()
# Create your models here. # Create your models here.