mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 04:15:10 +00:00
(cherry picked from commit 88d849320f)
Co-authored-by: Chillar Anand <anand21nanda@gmail.com>
This commit is contained in:
@@ -242,7 +242,11 @@ def get_salary_structure(employee):
|
||||
order_by = "from_date desc")[0].salary_structure
|
||||
|
||||
def get_last_salary_slip(employee):
|
||||
return frappe.get_list("Salary Slip", filters = {
|
||||
salary_slips = frappe.get_list("Salary Slip", filters = {
|
||||
"employee": employee, 'docstatus': 1
|
||||
},
|
||||
order_by = "start_date desc")[0].name
|
||||
order_by = "start_date desc"
|
||||
)
|
||||
if not salary_slips:
|
||||
return
|
||||
return salary_slips[0].name
|
||||
|
||||
@@ -24,6 +24,11 @@ class TestGratuity(unittest.TestCase):
|
||||
frappe.db.sql("DELETE FROM `tabGratuity`")
|
||||
frappe.db.sql("DELETE FROM `tabAdditional Salary` WHERE ref_doctype = 'Gratuity'")
|
||||
|
||||
def test_get_last_salary_slip_should_return_none_for_new_employee(self):
|
||||
new_employee = make_employee("new_employee@salary.com", company='_Test Company')
|
||||
salary_slip = get_last_salary_slip(new_employee)
|
||||
assert salary_slip is None
|
||||
|
||||
def test_check_gratuity_amount_based_on_current_slab_and_additional_salary_creation(self):
|
||||
employee, sal_slip = create_employee_and_get_last_salary_slip()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user