fix: test cases
diff --git a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py
index f3449d4..99ad18f 100644
--- a/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py
+++ b/erpnext/hr/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py
@@ -41,7 +41,7 @@
def calculate_hra_exemption(self):
self.salary_structure_hra, self.annual_hra_exemption, self.monthly_hra_exemption = 0, 0, 0
- if self.monthly_house_rent:
+ if self.get("monthly_house_rent"):
hra_exemption = calculate_annual_eligible_hra_exemption(self)
if hra_exemption:
self.total_exemption_amount += hra_exemption["annual_exemption"]
diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py
index 23bd0c8..a600e75 100644
--- a/erpnext/hr/utils.py
+++ b/erpnext/hr/utils.py
@@ -227,7 +227,6 @@
subcategories.append(d.exemption_sub_category)
def get_total_exemption_amount(declarations):
- exemption_category = list(set([d.exemption_category for d in declarations]))
exemptions = frappe._dict()
for d in declarations:
exemptions.setdefault(d.exemption_category, frappe._dict())
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index a846385..f413a8e 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
import frappe, re
from frappe import _
-from frappe.utils import cstr, flt, date_diff, getdate, nowdate
+from frappe.utils import cstr, flt, date_diff, nowdate
from erpnext.regional.india import states, state_numbers
from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount
from erpnext.controllers.accounts_controller import get_taxes_and_charges
@@ -231,12 +231,17 @@
select name
from `tabEmployee Tax Exemption Proof Submission`
where
- docstatus=1 and employee='{0}' and payroll_period='{1}'
- and (rented_from_date between '{2}' and '{3}' or rented_to_date between '{2}' and '{3}')
- """.format(doc.employee, doc.payroll_period, doc.rented_from_date, doc.rented_to_date))
+ docstatus=1 and employee=%(employee)s and payroll_period=%(payroll_period)s
+ and (rented_from_date between %(from_date)s and %(to_date)s or rented_to_date between %(from_date)s and %(to_date)s)
+ """, {
+ "employee": doc.employee,
+ "payroll_period": doc.payroll_period,
+ "from_date": doc.rented_from_date,
+ "to_date": doc.rented_to_date
+ })
if proofs:
- frappe.throw(_("House rent paid days overlap with {0}").format(proofs[0][0]))
+ frappe.throw(_("House rent paid days overlapping with {0}").format(proofs[0][0]))
def calculate_hra_exemption_for_period(doc):
monthly_rent, eligible_hra = 0, 0