[FIX] hr_holidays: dynamic day selection for accrual plan milestones#4946
Open
SurryaT10 wants to merge 1 commit intomaster-hr-onboarding-suthafrom
Open
[FIX] hr_holidays: dynamic day selection for accrual plan milestones#4946SurryaT10 wants to merge 1 commit intomaster-hr-onboarding-suthafrom
SurryaT10 wants to merge 1 commit intomaster-hr-onboarding-suthafrom
Conversation
|
This PR targets the un-managed branch odoo-dev/odoo:master-hr-onboarding-sutha, it needs to be retargeted before it can be merged. |
7cf37ea to
c5e14d7
Compare
Bug reproduction steps: 1. Go to Time Off -> Configuration -> Accrual Plans. 2. Create or edit a plan and add/edit a Milestone. 3. Set the frequency to 'Yearly' or 'Twice a year'. 4. Observe that the 'Day of month' selection allows choosing '31' even if the selected month is February or April. Bug cause: The 'day' and 'month' fields were treated as independent selection fields. The day field used a static selection list (1-31) defined in the Python model, which did not account for the varying lengths of months. This allowed for invalid dates like February 31st to be saved in the database. Solution: Created a new OWL field widget 'day_selector' that extends the standard SelectionField. - The widget accepts a 'month' attribute via the view to track the sibling month field. - It dynamically computes the 'options' list based on the selected month using a JavaScript Date logic. - It utilizes a 'useEffect' hook to monitor changes in the month field; if the month changes to one with fewer days than the currently selected day, the widget automatically updates the record to the maximum valid day for that month (e.g., shifting 31 to 30 or 28). - Updated the accrual plan form view to apply this widget to the milestone day fields. task - 5468807
c5e14d7 to
99642e5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug reproduction steps:
Bug cause:
The 'day' and 'month' fields were treated as independent selection fields. The day field used a static selection list (1-31) defined in the Python model, which did not account for the varying lengths of months. This allowed for invalid dates like February 31st to be saved in the database.
Solution:
Created a new OWL field widget 'day_selector' that extends the standard SelectionField.
task - 5468807