Help

0

Set field options onchange

Avatar
Asis

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
1 Answer
0
Avatar
cabrejua
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