summaryrefslogtreecommitdiff
path: root/addons/web_calendar/static/src/js
diff options
context:
space:
mode:
authorfwi-odoo <fwi@odoo.com>2017-01-17 16:18:07 +0100
committerfwi-odoo <fwi@odoo.com>2017-02-16 14:48:01 +0100
commitebc1d24fc5767f670f67da98327f9fd5f8b2ef5b (patch)
treeb68cf5df09b1a300d55a2957eefea2399d4d8017 /addons/web_calendar/static/src/js
parent75f928e919c4cb225940d513df35075c71b62509 (diff)
[FIX] web_calendar: set default color when not define in the calendar view
Diffstat (limited to 'addons/web_calendar/static/src/js')
-rw-r--r--addons/web_calendar/static/src/js/web_calendar.js51
1 files changed, 26 insertions, 25 deletions
diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js
index 3a2f43e773f..cf44f7283e6 100644
--- a/addons/web_calendar/static/src/js/web_calendar.js
+++ b/addons/web_calendar/static/src/js/web_calendar.js
@@ -797,31 +797,32 @@ var CalendarView = View.extend({
self.now_filter_ids = [];
var color_field = self.fields[self.color_field];
- _.each(events, function (e) {
- var key,val = null;
- if (color_field.type == "selection") {
- key = e[self.color_field];
- val = _.find(color_field.selection, function(name){ return name[0] === key;});
- } else {
- key = e[self.color_field][0];
- val = e[self.color_field];
- }
- if (!self.all_filters[key]) {
- filter_item = {
- value: key,
- label: val[1],
- color: self.get_color(key),
- avatar_model: (utils.toBoolElse(self.avatar_filter, true) ? self.avatar_filter : false ),
- is_checked: true
- };
- self.all_filters[key] = filter_item;
- }
- if (! _.contains(self.now_filter_ids, key)) {
- self.now_filter_ids.push(key);
- }
- });
-
- if (self.sidebar) {
+ if (color_field) {
+ _.each(events, function (e) {
+ var key,val = null;
+ if (color_field.type == "selection") {
+ key = e[self.color_field];
+ val = _.find(color_field.selection, function(name){ return name[0] === key;});
+ } else {
+ key = e[self.color_field][0];
+ val = e[self.color_field];
+ }
+ if (!self.all_filters[key]) {
+ filter_item = {
+ value: key,
+ label: val[1],
+ color: self.get_color(key),
+ avatar_model: (utils.toBoolElse(self.avatar_filter, true) ? self.avatar_filter : false ),
+ is_checked: true
+ };
+ self.all_filters[key] = filter_item;
+ }
+ if (! _.contains(self.now_filter_ids, key)) {
+ self.now_filter_ids.push(key);
+ }
+ });
+ }
+ if (self.sidebar && color_field) {
self.sidebar.filter.render();
events = $.map(events, function (e) {