-
Notifications
You must be signed in to change notification settings - Fork 689
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd7da49
commit 7d7979b
Showing
1 changed file
with
31 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,23 +10,35 @@ | |
|
||
from hrms.hr.utils import DuplicateDeclarationError | ||
|
||
PAYROLL_PERIOD_NAME = "_Test Exemption Period" | ||
PAYROLL_PERIOD_START = "2022-01-01" | ||
PAYROLL_PERIOD_END = "2022-12-31" | ||
|
||
|
||
class TestEmployeeTaxExemptionDeclaration(FrappeTestCase): | ||
def setUp(self): | ||
frappe.db.delete("Employee Tax Exemption Declaration") | ||
frappe.db.delete("Salary Structure Assignment") | ||
frappe.db.delete("Salary Slip") | ||
|
||
make_employee("[email protected]", company="_Test Company") | ||
make_employee("[email protected]", company="_Test Company") | ||
create_payroll_period(company="_Test Company") | ||
|
||
create_payroll_period( | ||
company="_Test Company", | ||
name=PAYROLL_PERIOD_NAME, | ||
start_date=PAYROLL_PERIOD_START, | ||
end_date=PAYROLL_PERIOD_END, | ||
) | ||
create_exemption_category() | ||
frappe.db.delete("Employee Tax Exemption Declaration") | ||
frappe.db.delete("Salary Structure Assignment") | ||
|
||
def test_duplicate_category_in_declaration(self): | ||
declaration = frappe.get_doc( | ||
{ | ||
"doctype": "Employee Tax Exemption Declaration", | ||
"employee": frappe.get_value("Employee", {"user_id": "[email protected]"}, "name"), | ||
"company": erpnext.get_default_company(), | ||
"payroll_period": "_Test Payroll Period", | ||
"payroll_period": PAYROLL_PERIOD_NAME, | ||
"currency": erpnext.get_default_currency(), | ||
"declarations": [ | ||
dict( | ||
|
@@ -50,7 +62,7 @@ def test_duplicate_entry_for_payroll_period(self): | |
"doctype": "Employee Tax Exemption Declaration", | ||
"employee": frappe.get_value("Employee", {"user_id": "[email protected]"}, "name"), | ||
"company": erpnext.get_default_company(), | ||
"payroll_period": "_Test Payroll Period", | ||
"payroll_period": PAYROLL_PERIOD_NAME, | ||
"currency": erpnext.get_default_currency(), | ||
"declarations": [ | ||
dict( | ||
|
@@ -72,7 +84,7 @@ def test_duplicate_entry_for_payroll_period(self): | |
"doctype": "Employee Tax Exemption Declaration", | ||
"employee": frappe.get_value("Employee", {"user_id": "[email protected]"}, "name"), | ||
"company": erpnext.get_default_company(), | ||
"payroll_period": "_Test Payroll Period", | ||
"payroll_period": PAYROLL_PERIOD_NAME, | ||
"currency": erpnext.get_default_currency(), | ||
"declarations": [ | ||
dict( | ||
|
@@ -95,7 +107,7 @@ def test_exemption_amount(self): | |
"doctype": "Employee Tax Exemption Declaration", | ||
"employee": frappe.get_value("Employee", {"user_id": "[email protected]"}, "name"), | ||
"company": erpnext.get_default_company(), | ||
"payroll_period": "_Test Payroll Period", | ||
"payroll_period": PAYROLL_PERIOD_NAME, | ||
"currency": erpnext.get_default_currency(), | ||
"declarations": [ | ||
dict( | ||
|
@@ -127,7 +139,7 @@ def test_india_hra_exemption(self): | |
"doctype": "Employee Tax Exemption Declaration", | ||
"employee": employee, | ||
"company": "_Test Company", | ||
"payroll_period": "_Test Payroll Period", | ||
"payroll_period": PAYROLL_PERIOD_NAME, | ||
"currency": "INR", | ||
"monthly_house_rent": 50000, | ||
"rented_in_metro_city": 1, | ||
|
@@ -169,7 +181,7 @@ def test_india_hra_exemption_with_daily_payroll_frequency(self): | |
"doctype": "Employee Tax Exemption Declaration", | ||
"employee": employee, | ||
"company": "_Test Company", | ||
"payroll_period": "_Test Payroll Period", | ||
"payroll_period": PAYROLL_PERIOD_NAME, | ||
"currency": "INR", | ||
"monthly_house_rent": 170000, | ||
"rented_in_metro_city": 1, | ||
|
@@ -206,7 +218,7 @@ def test_india_hra_exemption_with_weekly_payroll_frequency(self): | |
"doctype": "Employee Tax Exemption Declaration", | ||
"employee": employee, | ||
"company": "_Test Company", | ||
"payroll_period": "_Test Payroll Period", | ||
"payroll_period": PAYROLL_PERIOD_NAME, | ||
"currency": "INR", | ||
"monthly_house_rent": 170000, | ||
"rented_in_metro_city": 1, | ||
|
@@ -243,7 +255,7 @@ def test_india_hra_exemption_with_fortnightly_payroll_frequency(self): | |
"doctype": "Employee Tax Exemption Declaration", | ||
"employee": employee, | ||
"company": "_Test Company", | ||
"payroll_period": "_Test Payroll Period", | ||
"payroll_period": PAYROLL_PERIOD_NAME, | ||
"currency": "INR", | ||
"monthly_house_rent": 170000, | ||
"rented_in_metro_city": 1, | ||
|
@@ -280,7 +292,7 @@ def test_india_hra_exemption_with_bimonthly_payroll_frequency(self): | |
"doctype": "Employee Tax Exemption Declaration", | ||
"employee": employee, | ||
"company": "_Test Company", | ||
"payroll_period": "_Test Payroll Period", | ||
"payroll_period": PAYROLL_PERIOD_NAME, | ||
"currency": "INR", | ||
"monthly_house_rent": 50000, | ||
"rented_in_metro_city": 1, | ||
|
@@ -321,8 +333,8 @@ def test_india_hra_exemption_with_multiple_salary_structure_assignments(self): | |
frappe.flags.country = "India" | ||
|
||
employee = make_employee("[email protected]", company="_Test Company") | ||
payroll_period = create_payroll_period(name="_Test Payroll Period", company="_Test Company") | ||
|
||
payroll_period = frappe.get_doc("Payroll Period", PAYROLL_PERIOD_NAME) | ||
create_tax_slab( | ||
payroll_period, | ||
allow_tax_exemption=True, | ||
|
@@ -463,7 +475,12 @@ def setup_hra_exemption_prerequisites(frequency, employee=None): | |
from hrms.payroll.doctype.salary_slip.test_salary_slip import create_tax_slab | ||
from hrms.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure | ||
|
||
payroll_period = create_payroll_period(name="_Test Payroll Period", company="_Test Company") | ||
payroll_period = create_payroll_period( | ||
name=PAYROLL_PERIOD_NAME, | ||
company="_Test Company", | ||
start_date=PAYROLL_PERIOD_START, | ||
end_date=PAYROLL_PERIOD_END, | ||
) | ||
if not employee: | ||
employee = frappe.get_value("Employee", {"user_id": "[email protected]"}, "name") | ||
|
||
|