-
Notifications
You must be signed in to change notification settings - Fork 117
[FIX] hr_holidays: dynamic accrual days #4904
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
base: master-hr-onboarding-haabo
Are you sure you want to change the base?
[FIX] hr_holidays: dynamic accrual days #4904
Conversation
|
This PR targets the un-managed branch odoo-dev/odoo:master-hr-onboarding-haabo, it needs to be retargeted before it can be merged. |
4329ea4 to
3207f98
Compare
Changed the {day} dropdown to adapt to the selected month. It was previously set to 31 for all months which allowed the user to select the 31st on a 28 or 30 day month for example.
task-5392293
3207f98 to
d7d62df
Compare
Mahmoudk3m
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work 🚀
Just a few comments.
| let date = new Date(2024, selectedMonth, 0); | ||
| let days = date.getDate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let date = new Date(2024, selectedMonth, 0); | |
| let days = date.getDate(); | |
| const date = new Date(2024, selectedMonth, 0); | |
| const days = date.getDate(); |
Use const instead of let where values don't change:
| const selectedMonth = this.props.record.data[this.props.selectedMonth]; | ||
| let date = new Date(2024, selectedMonth, 0); | ||
| let days = date.getDate(); | ||
| let newChoicesList = Array.from({length: days}, (_, i) => [(i + 1).toString(),(i + 1).toString()]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let newChoicesList = Array.from({length: days}, (_, i) => [(i + 1).toString(),(i + 1).toString()]) | |
| let newChoicesList = Array.from({length: days}, (_, i) => [(i + 1).toString(), (i + 1).toString()]) |
missing space after comma
|
|
||
| get options() { | ||
| const selectedMonth = this.props.record.data[this.props.selectedMonth]; | ||
| let date = new Date(2024, selectedMonth, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a comment to explain why I used 2024 specifically, because it might be a bit confusing.
|
|
||
|
|
||
| get options() { | ||
| const selectedMonth = this.props.record.data[this.props.selectedMonth]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If selectedMonth is undefined or invalid, this could fail silently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user has selected "31" for the day and then changes the month to one with only 30 days, what happens? 🤔
Changed the {day} dropdown to adapt to the selected month. It was previously set to 31 for all months which allowed the user to select the 31st on a 28 or 30 day month for example.
task-5392293