From 6cb33c664b4248f796a575637bbc44673708261e Mon Sep 17 00:00:00 2001 From: Stephan Rozendaal Date: Tue, 1 Aug 2017 10:14:09 +0200 Subject: [PATCH] [FIX] Check if date widget properties exist the options property of the dateWidget does not exist when the field is rendered in for example a list view. Check if the options and datepicker properties exist first. --- .../static/src/js/datepicker.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/web_widget_datepicker_options/static/src/js/datepicker.js b/web_widget_datepicker_options/static/src/js/datepicker.js index 1d9f422b..89750b2a 100644 --- a/web_widget_datepicker_options/static/src/js/datepicker.js +++ b/web_widget_datepicker_options/static/src/js/datepicker.js @@ -30,11 +30,13 @@ odoo.define('web_widget_datepicker_options', function (require) { init: function(parent, options) { this._super.apply(this, arguments); var self = this; - if (this.__parentedParent.options.datepicker) { - var options = this.__parentedParent.options.datepicker; - $.each(options, function(value, key) { - self.options[value] = key; - }); + if (self.__parentedParent.options instanceof Object) { + if (self.__parentedParent.options.datepicker instanceof Object) { + var options = this.__parentedParent.options.datepicker; + $.each(options, function(value, key) { + self.options[value] = key; + }); + } } }, });