[FIX] web_widget_datepicker_options: Fix error when field is undefined

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.
This commit is contained in:
Luis González
2018-06-11 00:00:07 +00:00
parent 442f5b7d61
commit ba73183d64
2 changed files with 3 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ odoo.define('web_widget_datepicker_options.datepicker', function(require) {
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;
@@ -24,6 +25,7 @@ odoo.define('web_widget_datepicker_options.datepicker', function(require) {
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;