Skip to Content
Menu
This question has been flagged
1 Reply
2428 Views

I want to update a datepicker widget when a route is selected so that only some days of the week are active. I can set the options directly on the field like so:

 <field name="fecha_recogida" options='{"datepicker":{"daysOfWeekDisabled": [0,1,2,6]}}'/>

ButI cant get it to work from the onchange event when the route field 'ruta_recogida' is selected:

@api.onchange('ruta_recogida')
    def _onchange_ruta_recogida(self):
        disable_some =  {'options':{
            'fecha_recogida': {"datepicker":{"daysOfWeekDisabled": [0,1,2,5,6]}}
        }}
        return disable_some


Is it possible to update the options of a field via  the .py file?






Avatar
Discard
Best Answer

Hi!
Afaik, you cannot modify the attribute "options" in your python file. Due to "datepicker" is a javascript widget, you should perform your changes in javascript.

Avatar
Discard
Related Posts Replies Views Activity
1
Oct 23
359
2
Oct 23
665
2
Aug 23
1957
4
Aug 23
18242
3
Oct 22
8897