跳至内容
菜单
此问题已终结
5773 查看

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.

形象
丢弃
相关帖文 回复 查看 活动
0
7月 17
2448
1
2月 24
1564
0
11月 23
1370
1
5月 20
10934
0
8月 19
3787