[FIX] calendar: avoid double popup, opw 606297
Some browsers (e.g. chrome) trigger onEmptyClick as well as onBeforeLightbox during drag&drop which calls two slow_create calls (and two popups). Workaround to kill the second one.
This commit is contained in:
parent
530d8bf3ce
commit
6e5bef9bd2
|
@ -57,6 +57,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({
|
|||
this.range_stop = null;
|
||||
this.update_range_dates(Date.today());
|
||||
this.selected_filters = [];
|
||||
this.is_slow_open = false;
|
||||
},
|
||||
view_loading: function(r) {
|
||||
return this.load_calendar(r);
|
||||
|
@ -465,6 +466,13 @@ instance.web_calendar.CalendarView = instance.web.View.extend({
|
|||
},
|
||||
slow_create: function(event_id, event_obj) {
|
||||
var self = this;
|
||||
// Workaround, some browsers trigger onEmptyClick as well as onBeforeLightbox
|
||||
// during drag&drop which calls two slow_create calls, kills the second one
|
||||
if (this.is_slow_open) {
|
||||
scheduler.deleteEvent(event_id);
|
||||
return;
|
||||
}
|
||||
this.is_slow_open = true;
|
||||
if (this.current_mode() === 'month') {
|
||||
event_obj['start_date'].addHours(8);
|
||||
if (event_obj._length === 1) {
|
||||
|
@ -487,6 +495,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({
|
|||
view_id: pop_infos.view_id,
|
||||
});
|
||||
pop.on('closed', self, function() {
|
||||
this.is_slow_open = false;
|
||||
if (!something_saved) {
|
||||
scheduler.deleteEvent(event_id);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue