fix: test cases
This commit is contained in:
@@ -41,7 +41,7 @@ class EmployeeTaxExemptionDeclaration(Document):
|
|||||||
|
|
||||||
def calculate_hra_exemption(self):
|
def calculate_hra_exemption(self):
|
||||||
self.salary_structure_hra, self.annual_hra_exemption, self.monthly_hra_exemption = 0, 0, 0
|
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)
|
hra_exemption = calculate_annual_eligible_hra_exemption(self)
|
||||||
if hra_exemption:
|
if hra_exemption:
|
||||||
self.total_exemption_amount += hra_exemption["annual_exemption"]
|
self.total_exemption_amount += hra_exemption["annual_exemption"]
|
||||||
|
|||||||
@@ -226,7 +226,6 @@ def validate_tax_declaration(declarations):
|
|||||||
subcategories.append(d.exemption_sub_category)
|
subcategories.append(d.exemption_sub_category)
|
||||||
|
|
||||||
def get_total_exemption_amount(declarations):
|
def get_total_exemption_amount(declarations):
|
||||||
exemption_category = list(set([d.exemption_category for d in declarations]))
|
|
||||||
exemptions = frappe._dict()
|
exemptions = frappe._dict()
|
||||||
for d in declarations:
|
for d in declarations:
|
||||||
exemptions.setdefault(d.exemption_category, frappe._dict())
|
exemptions.setdefault(d.exemption_category, frappe._dict())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, re
|
import frappe, re
|
||||||
from frappe import _
|
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.regional.india import states, state_numbers
|
||||||
from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount
|
from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount
|
||||||
from erpnext.controllers.accounts_controller import get_taxes_and_charges
|
from erpnext.controllers.accounts_controller import get_taxes_and_charges
|
||||||
@@ -231,12 +231,17 @@ def validate_house_rent_dates(doc):
|
|||||||
select name
|
select name
|
||||||
from `tabEmployee Tax Exemption Proof Submission`
|
from `tabEmployee Tax Exemption Proof Submission`
|
||||||
where
|
where
|
||||||
docstatus=1 and employee='{0}' and payroll_period='{1}'
|
docstatus=1 and employee=%(employee)s and payroll_period=%(payroll_period)s
|
||||||
and (rented_from_date between '{2}' and '{3}' or rented_to_date between '{2}' and '{3}')
|
and (rented_from_date between %(from_date)s and %(to_date)s or rented_to_date between %(from_date)s and %(to_date)s)
|
||||||
""".format(doc.employee, doc.payroll_period, doc.rented_from_date, doc.rented_to_date))
|
""", {
|
||||||
|
"employee": doc.employee,
|
||||||
|
"payroll_period": doc.payroll_period,
|
||||||
|
"from_date": doc.rented_from_date,
|
||||||
|
"to_date": doc.rented_to_date
|
||||||
|
})
|
||||||
|
|
||||||
if proofs:
|
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):
|
def calculate_hra_exemption_for_period(doc):
|
||||||
monthly_rent, eligible_hra = 0, 0
|
monthly_rent, eligible_hra = 0, 0
|
||||||
|
|||||||
Reference in New Issue
Block a user