Se rendre au contenu
Menu
Cette question a été signalée
5796 Vues

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
Ignorer
Publications associées Réponses Vues Activité
0
juil. 17
2456
1
févr. 24
1575
0
nov. 23
1389
1
mai 20
10970
0
août 19
3803