mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 22:49:19 +00:00
fix: earned leave policy assignment test
(cherry picked from commit aaa1ae94f2)
This commit is contained in:
committed by
mergify-bot
parent
b1d3d8226c
commit
d9ec973096
@@ -4,7 +4,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import add_months, get_first_day, get_last_day, getdate
|
from frappe.utils import add_days, add_months, get_first_day, get_last_day, getdate
|
||||||
|
|
||||||
from erpnext.hr.doctype.leave_application.test_leave_application import (
|
from erpnext.hr.doctype.leave_application.test_leave_application import (
|
||||||
get_employee,
|
get_employee,
|
||||||
@@ -94,9 +94,12 @@ class TestLeavePolicyAssignment(unittest.TestCase):
|
|||||||
"leave_policy": leave_policy.name,
|
"leave_policy": leave_policy.name,
|
||||||
"leave_period": leave_period.name
|
"leave_period": leave_period.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# second last day of the month
|
||||||
|
# leaves allocated should be 0 since it is an earned leave and allocation happens via scheduler based on set frequency
|
||||||
|
frappe.flags.current_date = add_days(get_last_day(getdate()), -1)
|
||||||
leave_policy_assignments = create_assignment_for_multiple_employees([self.employee.name], frappe._dict(data))
|
leave_policy_assignments = create_assignment_for_multiple_employees([self.employee.name], frappe._dict(data))
|
||||||
|
|
||||||
# leaves allocated should be 0 since it is an earned leave and allocation happens via scheduler based on set frequency
|
|
||||||
leaves_allocated = frappe.db.get_value("Leave Allocation", {
|
leaves_allocated = frappe.db.get_value("Leave Allocation", {
|
||||||
"leave_policy_assignment": leave_policy_assignments[0]
|
"leave_policy_assignment": leave_policy_assignments[0]
|
||||||
}, "total_leaves_allocated")
|
}, "total_leaves_allocated")
|
||||||
|
|||||||
Reference in New Issue
Block a user