From 20facf5cf93faad4c8f03304540103f19adb9a16 Mon Sep 17 00:00:00 2001 From: Felix Date: Thu, 27 Apr 2017 10:21:39 +0200 Subject: [PATCH] [FIX] web_calendar: prevent crash when the color field is undefined Add a check for the presence of color field. (only applies when "useContacts" is not set) Before this fix, if the view xml does not set "useContacts", the calendar view fallback on the color attribute (not required) which may be non-existent on the model and on the view. web_calendar.js:799 is using "if (color_field.type == "selection")" so its throwing this error when color is not defined: Uncaught TypeError: Cannot read property 'type' of undefined --- addons/web_calendar/static/src/js/web_calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js index d197d0c2794..be6e1743ddc 100644 --- a/addons/web_calendar/static/src/js/web_calendar.js +++ b/addons/web_calendar/static/src/js/web_calendar.js @@ -788,7 +788,7 @@ var CalendarView = View.extend({ return; } - if (!self.useContacts) { // If we use all peoples displayed in the current month as filter in sidebars + if (!self.useContacts && self.fields[self.color_field]) { // If we use all peoples displayed in the current month as filter in sidebars var filter_item; self.now_filter_ids = [];