Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in months passed function #1057

Open
1 task done
bahaou opened this issue Nov 13, 2023 · 1 comment · May be fixed by #1269
Open
1 task done

bug in months passed function #1057

bahaou opened this issue Nov 13, 2023 · 1 comment · May be fixed by #1269
Assignees
Labels
bug Something isn't working

Comments

@bahaou
Copy link

bahaou commented Nov 13, 2023

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

  • I agree to follow this project's Code of Conduct
@bahaou bahaou added the bug Something isn't working label Nov 13, 2023
@bahaou
Copy link
Author

bahaou commented Nov 13, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants