From 91417516ae9399793697d569569dc49945971213 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 5 Aug 2015 14:21:58 +0200 Subject: [PATCH] [FIX] web_calendar: use of selection fields as color filters Using a selection field as color filters in a calendar view had as effect to display the second letter of the state name (The state name string, index 1) as filter, instead of the full state name. Besides, the colors of the filters did not match. e.g., Sales > Sales > Sales Orders > Calendar View opw-646486 --- addons/web_calendar/static/src/js/web_calendar.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js index 87554e52e1d..4589a471283 100644 --- a/addons/web_calendar/static/src/js/web_calendar.js +++ b/addons/web_calendar/static/src/js/web_calendar.js @@ -688,9 +688,9 @@ openerp.web_calendar = function(instance) { var color_field = self.fields[self.color_field]; _.each(events, function (e) { var key,val = null; - if (self.color_field.type == "selection") { + if (color_field.type == "selection") { key = e[self.color_field]; - val = _.find( self.color_field.selection, function(name){ return name[0] === key;}); + val = _.find(color_field.selection, function(name){ return name[0] === key;}); } else { key = e[self.color_field][0]; @@ -716,7 +716,7 @@ openerp.web_calendar = function(instance) { self.sidebar.filter.set_filters(); events = $.map(events, function (e) { - var key = self.color_field.type == "selection" ? e[self.color_field] : e[self.color_field][0]; + var key = color_field.type == "selection" ? e[self.color_field] : e[self.color_field][0]; if (_.contains(self.now_filter_ids, key) && self.all_filters[key].is_checked) { return e; }