Skip to Content
Menu
This question has been flagged
5799 Zobrazenia

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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
0
júl 17
2456
1
feb 24
1575
0
nov 23
1392
1
máj 20
10971
0
aug 19
3803