* Year removed from birthday due to privacu issue of each employee and for maintaining integrity of each employee * year removed from employee detail page of employees section * PDF readability managed by setting font and also make file name different with employee_id which contains name and id * pre save signal runs for twice in company case and create contract instance twice setted it to post save for stop duplication
This commit is contained in:
committed by
GitHub
parent
d49339de7f
commit
11cd162912
@@ -1443,9 +1443,9 @@ class Payslip(HorillaModel):
|
||||
if self.group_name:
|
||||
return self.group_name
|
||||
return (
|
||||
f"Payslip {self.start_date} to {self.end_date}"
|
||||
f"Payslip {self.start_date} to {self.end_date} for {self.employee_id}"
|
||||
if self.start_date != self.end_date
|
||||
else f"Payslip for {self.start_date}"
|
||||
else f"Payslip for {self.start_date} for {self.employee_id}"
|
||||
)
|
||||
|
||||
def get_days_in_month(self):
|
||||
|
||||
@@ -9,7 +9,7 @@ from payroll.methods.deductions import create_deductions
|
||||
from payroll.models.models import Allowance, Contract, Deduction, LoanAccount, Payslip
|
||||
|
||||
|
||||
@receiver(pre_save, sender=EmployeeWorkInformation)
|
||||
@receiver(post_save, sender=EmployeeWorkInformation)
|
||||
def employeeworkinformation_pre_save(sender, instance, **_kwargs):
|
||||
"""
|
||||
This method is used to override the save method for EmployeeWorkInformation Model
|
||||
@@ -18,8 +18,7 @@ def employeeworkinformation_pre_save(sender, instance, **_kwargs):
|
||||
instance.employee_id if instance.employee_id.is_active == True else None
|
||||
)
|
||||
if active_employee is not None:
|
||||
all_contracts = Contract.objects.entire()
|
||||
contract_exists = all_contracts.filter(employee_id_id=active_employee).exists()
|
||||
contract_exists = active_employee.contract_set.exists()
|
||||
if not contract_exists:
|
||||
contract = Contract()
|
||||
contract.contract_name = f"{active_employee}'s Contract"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter" media="all">
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
|
||||
rel="stylesheet"
|
||||
|
||||
@@ -1466,7 +1466,10 @@ def generate_payslip_pdf(template_path, context, html=False):
|
||||
"margin-left": "10mm",
|
||||
"margin-right": "10mm",
|
||||
"encoding": "UTF-8",
|
||||
"enable-local-file-access": None, # Required to load local CSS/images
|
||||
"enable-local-file-access": None, # Required to load local CSS/images
|
||||
"dpi": 300,
|
||||
"zoom": 1.3,
|
||||
"footer-center": "[page]/[topage]",
|
||||
}
|
||||
|
||||
# Generate the PDF as binary content
|
||||
|
||||
Reference in New Issue
Block a user