diff --git a/addons/web/static/src/js/views/calendar/calendar_model.js b/addons/web/static/src/js/views/calendar/calendar_model.js index f927889a7c8..a404b618480 100644 --- a/addons/web/static/src/js/views/calendar/calendar_model.js +++ b/addons/web/static/src/js/views/calendar/calendar_model.js @@ -45,11 +45,6 @@ return AbstractModel.extend({ var start = event.start.clone(); var end = event.end && event.end.clone(); - // Detects allDay events (86400000 = 1 day in ms) - if (event.allDay || (end && end.diff(start) % 86400000 === 0)) { - event.allDay = true; - } - // Set end date if not existing if (!end || end.diff(start) < 0) { // undefined or invalid end date if (event.allDay) { diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js index 295c2aa540e..a6cc85f833e 100644 --- a/addons/web/static/tests/views/calendar_tests.js +++ b/addons/web/static/tests/views/calendar_tests.js @@ -3464,6 +3464,51 @@ QUnit.module('Views', { calendar.destroy(); }); + QUnit.test("drag and drop 24h event on week mode", async function (assert) { + assert.expect(1); + + var calendar = await createCalendarView({ + View: CalendarView, + model: 'event', + data: this.data, + arch: ` + + `, + archs: archs, + viewOptions: { + initialDate: initialDate, + }, + }, {positionalClicks: true}); + + var top = calendar.$('.fc-axis:contains(8:00)').offset().top + 5; + var left = calendar.$('.fc-day:eq(2)').offset().left + 5; + + try { + testUtils.dom.triggerPositionalMouseEvent(left, top, "mousedown"); + } catch (e) { + calendar.destroy(); + throw new Error('The test fails to simulate a click in the screen. Your screen is probably too small or your dev tools is open.'); + } + + top = calendar.$('.fc-axis:contains(8:00)').offset().top - 5; + var leftNextDay = calendar.$('.fc-day:eq(3)').offset().left + 5; + testUtils.dom.triggerPositionalMouseEvent(leftNextDay, top, "mousemove"); + await testUtils.dom.triggerPositionalMouseEvent(leftNextDay, top, "mouseup"); + await testUtils.nextTick(); + assert.equal($('.o_field_boolean.o_field_widget[name=allday] input').is(':checked'), false, + "The event must not have the all_day active"); + await testUtils.dom.click($('.modal button.btn:contains(Discard)')); + + calendar.destroy(); + }); + }); });