fix: test cases
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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"]
|
||||||
|
|||||||
Reference in New Issue
Block a user