From 75b7737c45aef6548c7ce093bffccc043eb50793 Mon Sep 17 00:00:00 2001 From: Akash Tom <61287991+krantheman@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:56:06 +0530 Subject: [PATCH] fix(Income Tax Computation): computation of total tax exemption (#1902) (cherry picked from commit b00a87afaa3ccfe44dd4934ad1bad03f85edec76) --- .../income_tax_computation.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hrms/payroll/report/income_tax_computation/income_tax_computation.py b/hrms/payroll/report/income_tax_computation/income_tax_computation.py index 73331ae7a1..cd27e90c5d 100644 --- a/hrms/payroll/report/income_tax_computation/income_tax_computation.py +++ b/hrms/payroll/report/income_tax_computation/income_tax_computation.py @@ -231,7 +231,8 @@ def get_tax_exempted_earnings_and_deductions(self): self.employees[employee].update(exemptions) total_exemptions = sum(list(exemptions.values())) - self.add_to_total_exemption(employee, total_exemptions) + self.employees[employee]["total_exemption"] = 0 + self.employees[employee]["total_exemption"] += total_exemptions def add_exemptions_from_future_salary_slips(self, employee, exemptions): for ss in self.future_salary_slips.get(employee, []): @@ -272,10 +273,6 @@ def get_tax_exempted_components(self): return tax_exempted_components - def add_to_total_exemption(self, employee, amount): - self.employees[employee].setdefault("total_exemption", 0) - self.employees[employee]["total_exemption"] += amount - def get_employee_tax_exemptions(self): # add columns exemption_categories = frappe.get_all("Employee Tax Exemption Category", {"is_active": 1}) @@ -323,7 +320,7 @@ def get_tax_exemptions(self, source): amount = max_eligible_amount self.employees[d.employee].setdefault(scrub(d.exemption_category), amount) - self.add_to_total_exemption(d.employee, amount) + self.employees[d.employee]["total_exemption"] += amount if ( source == "Employee Tax Exemption Proof Submission" @@ -375,7 +372,8 @@ def get_eligible_hra(self, source): if d[0] not in self.employees_with_proofs: self.employees[d[0]].setdefault("hra", d[1]) - self.add_to_total_exemption(d[0], d[1]) + + self.employees[d[0]]["total_exemption"] += d[1] self.employees_with_proofs.append(d[0]) def get_standard_tax_exemption(self): @@ -397,7 +395,7 @@ def get_standard_tax_exemption(self): income_tax_slab = emp_details.get("income_tax_slab") standard_exemption = standard_exemptions_per_slab.get(income_tax_slab, 0) emp_details["standard_tax_exemption"] = standard_exemption - self.add_to_total_exemption(emp, standard_exemption) + self.employees[emp]["total_exemption"] += standard_exemption self.add_column("Total Exemption")