summaryrefslogtreecommitdiff
path: root/addons/web_calendar/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-02-17 18:07:21 +0100
committerChristophe Simonis <chs@odoo.com>2016-02-17 18:07:21 +0100
commit60c9cac46b0f32069a6763c3bf0b9e3a64d90e7d (patch)
tree4a234008ac69f9b573efc310f93e7a2ac850bce0 /addons/web_calendar/static/src/js
parent4ecba34944e04e8be88e2588407dd84fc24bbe0a (diff)
parent87a01c75ef1dde98bc31f714d8ac4b2ea598e316 (diff)
[MERGE] forward port of branch saas-9 up to 87a01c7
Diffstat (limited to 'addons/web_calendar/static/src/js')
-rw-r--r--addons/web_calendar/static/src/js/web_calendar.js11
-rw-r--r--addons/web_calendar/static/src/js/widgets.js2
2 files changed, 11 insertions, 2 deletions
diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js
index 3f7c9a0630a..bb37fc95569 100644
--- a/addons/web_calendar/static/src/js/web_calendar.js
+++ b/addons/web_calendar/static/src/js/web_calendar.js
@@ -630,7 +630,7 @@ var CalendarView = View.extend({
r.className = 'o_calendar_color_'+ this.get_color(color_key);
}
} else { // if form all, get color -1
- r.className = 'o_calendar_color_'+ self.all_filters[-1] ? self.all_filters[-1].color : 1;
+ r.className = 'o_calendar_color_'+ (self.all_filters[-1] ? self.all_filters[-1].color : 1);
}
return r;
},
@@ -834,6 +834,15 @@ var CalendarView = View.extend({
},
/**
+ * Get all_filters ordered by label
+ */
+ get_all_filters_ordered: function() {
+ return _.values(this.all_filters).sort(function(f1,f2) {
+ return _.string.naturalCmp(f1.label, f2.label);
+ });
+ },
+
+ /**
* Updates record identified by ``id`` with values in object ``data``
*/
update_record: function(id, data) {
diff --git a/addons/web_calendar/static/src/js/widgets.js b/addons/web_calendar/static/src/js/widgets.js
index e5d0f5ae4b8..39324d3caf0 100644
--- a/addons/web_calendar/static/src/js/widgets.js
+++ b/addons/web_calendar/static/src/js/widgets.js
@@ -222,7 +222,7 @@ var SidebarFilter = Widget.extend({
var self = this;
if (!filters) {
filters = [];
- _.forEach(self.view.all_filters, function(o) {
+ _.forEach(self.view.get_all_filters_ordered(), function(o) {
if (_.contains(self.view.now_filter_ids, o.value)) {
filters.push(o);
}