Skip to content

Conversation

@hazemayman1
Copy link

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

@robodoo
Copy link

robodoo commented Dec 5, 2025

This PR targets the un-managed branch odoo-dev/odoo:master-hr-onboarding-haabo, it needs to be retargeted before it can be merged.

@hazemayman1 hazemayman1 force-pushed the master-hr-onboarding-ux_accrual-haabo branch 2 times, most recently from 3207f98 to d7d62df Compare December 10, 2025 09:13
Copy link

@Mahmoudk3m Mahmoudk3m left a 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.

Comment on lines 13 to 14
let date = new Date(2024, selectedMonth, 0);
let days = date.getDate();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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()])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


get options() {
const selectedMonth = this.props.record.data[this.props.selectedMonth];
let date = new Date(2024, selectedMonth, 0);

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done



get options() {
const selectedMonth = this.props.record.data[this.props.selectedMonth];

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a condition to prompt the user and not give him any day options to select from

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? 🤔

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The widget automatically adjusts I think it's because it's watching on the selectedMonth prop to recall the function on change

@arpi-odoo arpi-odoo force-pushed the master-hr-onboarding-haabo branch from 8724928 to fdc2c51 Compare December 15, 2025 10:26
@hazemayman1 hazemayman1 force-pushed the master-hr-onboarding-ux_accrual-haabo branch from d7d62df to ac4b195 Compare December 16, 2025 15:52
Comment on lines 13 to 15
if (isNaN(selectedMonth) || selectedMonth < 1 || selectedMonth > 12){
alert("Please select a valid month.");
return;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using alert is not really standard for Odoo. You could raise an error if you want to do that.

What I had meant was to just check if it exists before the condition

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

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
@hazemayman1 hazemayman1 force-pushed the master-hr-onboarding-ux_accrual-haabo branch from ac4b195 to fd32130 Compare December 17, 2025 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants