frappe / hrms

Open Source HR and Payroll Software
https://frappe.io/hr
GNU General Public License v3.0
1.39k stars 728 forks source link

bug in months passed function #1057

Closed bahaou closed 1 month ago

bahaou commented 1 year ago

Information about bug

in policy assignment there is a function called _get_months_passed that says if current_date.year > from_date.year: months_passed = (12 - from_date.month) + current_date.month

well if from_date is 5 years ago for example 2018 . this formula is not working you should add all months in between 2018 and the current year . PS: an employee can have a date of joining in 2018 and while assigning hits leave policy today I can select date of joining as from_date . but while allocating leaves for previous months , this function is not working if the gap is greater than 2 years .

Module

HR

Version

version-14

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

No response

Code of Conduct

bahaou commented 1 year ago

it could be fixed with this code : months_passed = (12 - from_date.month) + current_date.month+ 12*(current_date.year-from_date.year-1)