Open jigneshpshah opened 3 years ago
8/4 =2/3 = 0.66
@jigneshpshah can you please explain this
Leave Type = Sick Leave Earned Frequency = Quarterly Annual Allocation = 8 Which means every quarter 2 leave should be credited.
Leave Policy: 8 AnnualSick Leaves
So if we do a leave allocation on 20thJune 2021 for leave period Jan to Dec 2021 via leave policy assignment it should assign 4 leaves.
Current Behaviour : The leaves which are allocated is 10 (it allocates 2 per month 5x 2)
Expected Behaviour : system should alllocate 2 leaves (for Jan-March quarter)
@jigneshpshah encountered this issue while working on a feature: https://github.com/frappe/hrms/pull/269
I wanted to validate one more case. As per your functional understanding, how should the following scenario ideally be handled?
12 annual leaves with quarterly freq
Ideally, 12/4 = 3 leaves should get allocated every quarter. But currently, the system assigns leaves every month (1 leave every month for 3 months). Do you think this is ideal?
Should it be like 3 leaves allocated at the start of the quarter and then no leaves allocated for the next 3 months until the quarter ends? The current functionality still behaves at a Monthly frequency technically.
if the earned leave frequency is quarterly then quarterly allocation is correct.
the number of leaves should be allocated on the first / last day (depending on the allocate_on_day) of the quarter & nothing should happen for the other two months of the quarter
e.g. 12 annual leaves with quarterly frequency
Q1 - (Jan - March ) then 3 leaves should be allocated either a) on 1st Jan ( nothing for Feb & March) OR b)31st March ( nothing for Jan & Feb)
similarly for Q2, Q3, Q4.
Use Case : Annual Leaves : 8 Earning Frequency : Quarter
Current Behaviour : get_monthly_earned_leave calculates below as 8/4 = 2 , which is incorrect. https://github.com/frappe/erpnext/blob/095048125318814f2c0c36cf49942b7b90879f67/erpnext/hr/utils.py#L353
Expected Behaviour : get_monthly_earned_leave should calculate = 8/4 =2/3 = 0.66