fix: test cases

This commit is contained in:
Nabin Hait 2019-04-25 19:54:20 +05:30
parent 04e7bf464f
commit 49446ba760
3 changed files with 11 additions and 7 deletions

View File

@ -41,7 +41,7 @@ class EmployeeTaxExemptionDeclaration(Document):
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"]

View File

@ -227,7 +227,6 @@ def validate_tax_declaration(declarations):
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())

View File

@ -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 @@ def validate_house_rent_dates(doc):
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