Ir al contenido
Menú
Se marcó esta pregunta
5792 Vistas

How to extend or inherit a javascript object from a custom module, I want extend the object instance.web.DateTimeWidget from addons/web/static/src/js/view_form.js to set the yearRange in the picker method.

The original file:

instance.web.DateTimeWidget = instance.web.Widget.extend({

...

this.picker({
            onClose: this.on_picker_select,
            onSelect: this.on_picker_select,
            changeMonth: true,
            changeYear: true,
            showWeek: true,
            showButtonPanel: true,
            firstDay: Date.CultureInfo.firstDayOfWeek
        });

...

});

I want this:

instance.web.DateTimeWidget = instance.web.Widget.extend({

...

this.picker({
            onClose: this.on_picker_select,
            onSelect: this.on_picker_select,
            changeMonth: true,
            changeYear: true,
            yearRange: 'c-70:c+0',
            showWeek: true,
            showButtonPanel: true,
            firstDay: Date.CultureInfo.firstDayOfWeek
        });

...

});

All this without modifying the file that brings odoo view_form.js.

Thanks.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
jul 17
2455
1
feb 24
1572
0
nov 23
1389
1
may 20
10970
0
ago 19
3803