-
Notifications
You must be signed in to change notification settings - Fork 23.2k
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
[FIX] web: Expose datepicker configuration to view declarations #25044
Conversation
The lower-level widget itself supports passing options to the underlying datepicker library, but this is not exposed to higher-level view declaration. With this patch, one can declare a field in a view such as: ```xml <field name="datefield" options='{"daysOfWeekDisabled": [0, 6]}'/> ``` That option would land in the widget and disable those weekdays.
Hello, Changes look goot to me, except that I would make them in master as this is not really a bugfix. Just to be sure I would ask for @ged-odoo review. |
I proposed it for v11 because it means no backwards compatibility problems. However, if you prefer for master, it would be good too 😊 |
Weird, I can't imagine how this change is breaking the test... 😕 |
return new datepicker.DateWidget(this, {defaultDate: this.value}); | ||
var datepicker_options; | ||
try { | ||
datepicker_options = this.attrs.options.datepicker; |
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.
Isn't it simpler to do datepicker_options = this.attrs.options.datepicker || {} ?
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.
Hmm it must be that.
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.
tde is right
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 was worried about this.attrs.options
being undefined
, but I didn't know about this.nodeOptions
. It's changed now.
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.
also, this should be documented in javascript_reference, in the section about fielddate/fielddatetime at the end
37c3d23
to
51d3a98
Compare
Docs added |
The lower-level widget itself supports passing options to the underlying datepicker library. However this is not exposed to higher-level view declaration. With this patch, one can declare a field in a view such as: ```xml <field name="datefield" options='{"daysOfWeekDisabled": [0, 6]}'/> ``` That option would land in the widget and disable those weekdays. Documentation has been updated accordingly. Closes #25044.
Landed in 11 at 71334b1 . Thanks to everybody ! |
This addon is no longer needed since odoo/odoo#25044 (comment), so I remove it.
This addon is no longer needed since odoo/odoo#25044 (comment), so I remove it.
This addon is no longer needed since odoo/odoo#25044 (comment), so I remove it.
This addon is no longer needed since odoo/odoo#25044 (comment) and odoo/odoo#27541, so I remove it.
This addon is no longer needed since odoo/odoo#25044 (comment) and odoo/odoo#27541, so I remove it.
The lower-level widget itself supports passing options to the underlying datepicker library, but this is not exposed to higher-level view declaration.
With this patch, one can declare a field in a view such as:
That option would land in the widget and disable those weekdays.
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
@Tecnativa @ged-odoo