fix: test cases

This commit is contained in:
Nabin Hait
2019-04-25 21:42:01 +05:30
parent 485d9c133a
commit 4a950abf2e
2 changed files with 9 additions and 7 deletions

View File

@@ -21,12 +21,13 @@ class EmployeeTaxExemptionDeclaration(Document):
self.calculate_hra_exemption() self.calculate_hra_exemption()
def validate_duplicate(self): def validate_duplicate(self):
duplicate = frappe.db.exists({ duplicate = frappe.db.get_value("Employee Tax Exemption Declaration",
"doctype": "Employee Tax Exemption Declaration", filters = {
"employee": self.employee, "employee": self.employee,
"payroll_period": self.payroll_period, "payroll_period": self.payroll_period,
"name": ["!=", self.name] "name": ["!=", self.name]
}) }
)
if duplicate: if duplicate:
frappe.throw(_("Duplicate Tax Declaration of {0} for period {1}") frappe.throw(_("Duplicate Tax Declaration of {0} for period {1}")
.format(self.employee, self.payroll_period), DuplicateDeclarationError) .format(self.employee, self.payroll_period), DuplicateDeclarationError)

View File

@@ -25,7 +25,8 @@ class EmployeeTaxExemptionProofSubmission(Document):
self.exemption_amount = get_total_exemption_amount(self.tax_exemption_proofs) self.exemption_amount = get_total_exemption_amount(self.tax_exemption_proofs)
def calculate_hra_exemption(self): def calculate_hra_exemption(self):
if self.house_rent_payment_amount: self.monthly_hra_exemption, self.monthly_house_rent, self.total_eligible_hra_exemption = 0, 0, 0
if self.get("house_rent_payment_amount"):
hra_exemption = calculate_hra_exemption_for_period(self) hra_exemption = calculate_hra_exemption_for_period(self)
if hra_exemption: if hra_exemption:
self.exemption_amount += hra_exemption["total_eligible_hra_exemption"] self.exemption_amount += hra_exemption["total_eligible_hra_exemption"]