test: fix salary component not found; other optimisation (#24920)
This commit is contained in:
parent
cbd67e662f
commit
cf3fc99b12
@ -15,9 +15,12 @@ from frappe.utils import getdate, add_days, get_datetime, flt
|
||||
|
||||
test_dependencies = ["Salary Component", "Salary Slip", "Account"]
|
||||
class TestGratuity(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
make_earning_salary_component(setup=True, test_tax=True, company_list=['_Test Company'])
|
||||
make_deduction_salary_component(setup=True, test_tax=True, company_list=['_Test Company'])
|
||||
|
||||
def setUp(self):
|
||||
frappe.db.sql("DELETE FROM `tabGratuity`")
|
||||
frappe.db.sql("DELETE FROM `tabAdditional Salary` WHERE ref_doctype = 'Gratuity'")
|
||||
|
||||
|
@ -361,7 +361,6 @@ class TestSalarySlip(unittest.TestCase):
|
||||
# as per assigned salary structure 40500 in monthly salary so 236000*5/100/12
|
||||
frappe.db.sql("""delete from `tabPayroll Period`""")
|
||||
frappe.db.sql("""delete from `tabSalary Component`""")
|
||||
frappe.db.sql("""delete from `tabAdditional Salary`""")
|
||||
|
||||
payroll_period = create_payroll_period()
|
||||
|
||||
|
@ -13,9 +13,18 @@ from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_
|
||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
|
||||
from erpnext.payroll.doctype.salary_structure.test_salary_structure \
|
||||
import make_salary_structure, create_salary_structure_assignment
|
||||
from erpnext.payroll.doctype.salary_slip.test_salary_slip import (
|
||||
make_earning_salary_component,
|
||||
make_deduction_salary_component
|
||||
)
|
||||
from erpnext.hr.doctype.employee.test_employee import make_employee
|
||||
|
||||
class TestTimesheet(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
make_earning_salary_component(setup=True, company_list=['_Test Company'])
|
||||
make_deduction_salary_component(setup=True, company_list=['_Test Company'])
|
||||
|
||||
def setUp(self):
|
||||
for dt in ["Salary Slip", "Salary Structure", "Salary Structure Assignment", "Timesheet"]:
|
||||
frappe.db.sql("delete from `tab%s`" % dt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user