Calendar Bug in Chrome and IE11

Bug #1314062 reported by Raymond Schmidt
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

Platform: Windows, Ubuntu
OpenERP Version: 7.0
Browser: Chrome Version 34.0.1847.131, IE 11

Produce Error as Following:

1. Modul hr_holidays is needed
2. Human Resources->Leave Requests
3. Drag the duration of your holiday in Calendar
4. A leave request form appears with wrong end date and wrong duration. Behind this window is an other on with the correct values.
5. If you click on close you see the second window with the correct values.

we found the with commenting out these lines:
web/addons/web_calendar/static/src/js/calendar.js:214
/*
        scheduler.attachEvent('onEmptyClick', function(start_date, mouse_event) {
            scheduler._loading = false; // Dirty workaround for a dhtmleditor bug I couln't track
            if (!self.$el.find('.dhx_cal_editor').length) {
                var end_date = new Date(start_date);
                end_date.addHours(1);
                scheduler.addEvent({
                    start_date: start_date,
                    end_date: end_date,
                    _force_slow_create: true,
                });
            }
        });
*/

it works fine. We don`t know why this hack is need and a bit afraid of side effects coursed by commenting this out. Is this a known issue? In trunk everthing has changed.

description: updated
Revision history for this message
Chang Phui-Hock (phuihock) wrote :

I have the same problem and your suggestion fixes the bug partially.

'onEmptyClick' is responsible for handling click event on empty box, while 'onBeforeLightbox' (the one right below it) handles drag event. Commenting 'onEmptyClick' event binding prevents the holiday form from opening if you click on an empty box.

I found a possible fix, but it involves upgrading dhtmlxScheduler to the latest version (4.0) and add the following line to
web/addons/web_calendar/static/src/js/calendar.js:231

        scheduler.attachEvent("onBeforeLightbox", function (event_id) {
            var index = self.dataset.get_id_index(event_id);
            if (index !== null) {
                self.open_event(self.dataset.ids[index]);
            } else {
                scheduler._ignore_next_click = true; // works only if you upgrade dhtmlxScheduler to the latest 4.0
                self.slow_create(event_id, scheduler.getEvent(event_id));
            }
           return false;
        });

However, I am not sure if this will introduce any regression. But it seems to work fine on my Chrome and FF.

Revision history for this message
Raymond Schmidt (raymond-schmidt) wrote :

We fixed this with a workaround without updating dhtmlxScheduler. We checking if already a event exsists and if this is the case the 'onEmptyClick' code will not be fired:

        scheduler.attachEvent('onEmptyClick', function(start_date, mouse_event) {
            /* Ray says: "This needed to be shure that only one event in Chrome is fired in chrome and ie11" */
            if( doNotExecuteEvent["onEmptyId"] && scheduler.getEvent(doNotExecuteEvent["onEmptyId"])) {
                doNotExecuteEvent["onEmptyId"] = false;
                return;
            }

            scheduler._loading = false; // Dirty workaround for a dhtmleditor bug I couln't track
            if ($('.dhx_cal_editor').length == 0) {
                var end_date = new Date(start_date);
                end_date.addHours(1);
                scheduler.addEvent({
                    start_date: start_date,
                    end_date: end_date,
                    _force_slow_create: true
                });
            }
        });
        scheduler.attachEvent("onBeforeLightbox", function (event_id) {
            var index = self.dataset.get_id_index(event_id);
            if (index !== null) {
                self.open_event(self.dataset.ids[index]);
            } else {
                self.slow_create(event_id, scheduler.getEvent(event_id));
                doNotExecuteEvent["onEmptyId"] = event_id;
            }

           return false;
        });

summary: - Calendar Bug in Chrome
+ Calendar Bug in Chrome and IE11
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.