mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Currently, when a view is rendered and a date or datetime field is not defined (e.g. when designing reports), it causes a JS error. This patch fixes the above error.
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
/*
|
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
*/
|
|
|
|
odoo.define('web_widget_datepicker_options.datepicker', function(require) {
|
|
"use strict";
|
|
var Widget = require('web.datepicker');
|
|
|
|
Widget.DateWidget.include({
|
|
init: function() {
|
|
this._super.apply(this, arguments);
|
|
var parent = this.getParent();
|
|
if(typeof parent !== 'undefined'
|
|
&& typeof parent.field !== 'undefined'
|
|
&& parent.field.type === 'date'
|
|
&& parent.nodeOptions){
|
|
var datepicker = parent.nodeOptions.datepicker;
|
|
_.assign(this.options, datepicker);
|
|
}
|
|
},
|
|
});
|
|
|
|
Widget.DateTimeWidget.include({
|
|
init: function() {
|
|
this._super.apply(this, arguments);
|
|
var parent = this.getParent();
|
|
if(typeof parent !== 'undefined'
|
|
&& typeof parent.field !== 'undefined'
|
|
&& parent.field.type === 'datetime'
|
|
&& parent.nodeOptions){
|
|
var datepicker = parent.nodeOptions.datepicker;
|
|
_.assign(this.options, datepicker);
|
|
}
|
|
},
|
|
});
|
|
});
|