summaryrefslogtreecommitdiff
path: root/addons/web_calendar/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-04-05 19:27:34 +0200
committerChristophe Simonis <chs@odoo.com>2016-04-05 19:27:34 +0200
commitaa6ebd146ad6ddaebb9ba7c5d93f2f87743dc248 (patch)
tree223d12d01e74e0bf41eed57a80fc6bfaeea61cea /addons/web_calendar/static/src
parent7014579d2222c6b4fa694e57853fe3fedb9cc55b (diff)
parent549daaaba455f883aa480a88fbf5df884d5555d0 (diff)
[MERGE] forward port of branch saas-9 up to 549daaa
Diffstat (limited to 'addons/web_calendar/static/src')
-rw-r--r--addons/web_calendar/static/src/js/web_calendar.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/addons/web_calendar/static/src/js/web_calendar.js b/addons/web_calendar/static/src/js/web_calendar.js
index 7b03e1b73d7..b42bdd5c2d9 100644
--- a/addons/web_calendar/static/src/js/web_calendar.js
+++ b/addons/web_calendar/static/src/js/web_calendar.js
@@ -86,6 +86,9 @@ var CalendarView = View.extend({
this.title = (this.options.action)? this.options.action.name : '';
this.shown = $.Deferred();
+ self.current_start = null;
+ self.current_end = null;
+ self.previous_ids = [];
},
set_default_options: function(options) {
@@ -729,11 +732,25 @@ var CalendarView = View.extend({
);
}
}
+
+ // read_slice is launched uncoditionally, when quickly
+ // changing the range in the calender view, all of
+ // these RPC calls will race each other. Because of
+ // this we keep track of the current range of the
+ // calendar view.
+ self.current_start = start;
+ self.current_end = end;
self.dataset.read_slice(_.keys(self.fields), {
offset: 0,
domain: event_domain,
context: context,
}).done(function(events) {
+ // undo the read_slice if it the range has changed since it launched
+ if (self.current_start.getTime() != start.getTime() || self.current_end.getTime() != end.getTime()) {
+ self.dataset.ids = self.previous_ids;
+ return;
+ }
+ self.previous_ids = self.dataset.ids.slice();
if (self.dataset.index === null) {
if (events.length) {
self.dataset.index = 0;