From 2adaeb589b0116b8f76f76f9c257b58786a7fabe Mon Sep 17 00:00:00 2001 From: Romeo Fragomeli Date: Mon, 25 May 2020 09:41:14 +0000 Subject: [PATCH] [FIX] web: deadlines are not visible in day/week calendar views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to commit odoo/odoo@0150141756addb9782b4978de904224cf65e7501 when the widget calendar is initialized with date type record for date_start and without all_day mapping events aren't shown on day/week views. This is because all day zone isn't visible when all_day mapping is not set. After this commit, we show the all day zone also when the date_start is a date type. Steps to reproduce: * Go to Project App * Select/Create a project * Select/Add a task with a deadline * Return to project * Select calendar view * Select week view (of the deadline) => BUG closes odoo/odoo#51818 X-original-commit: 1d83f4184e1b82db4dd4db54d98e509432340996 Signed-off-by: Adrien Dieudonné (adr) Signed-off-by: rfr-odoo --- .../src/js/views/calendar/calendar_model.js | 2 +- .../web/static/tests/views/calendar_tests.js | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) 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 a404b618480..403d828d824 100644 --- a/addons/web/static/src/js/views/calendar/calendar_model.js +++ b/addons/web/static/src/js/views/calendar/calendar_model.js @@ -452,7 +452,7 @@ return AbstractModel.extend({ dayNamesShort: moment.weekdaysShort(), firstDay: this.week_start, slotLabelFormat: _t.database.parameters.time_format.search("%H") !== -1 ? format24Hour : format12Hour, - allDaySlot: this.mapping.all_day, + allDaySlot: this.mapping.all_day || this.fields[this.mapping.date_start].type === 'date', }; }, /** diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js index c27ac85f498..7b69e8ce167 100644 --- a/addons/web/static/tests/views/calendar_tests.js +++ b/addons/web/static/tests/views/calendar_tests.js @@ -2468,6 +2468,26 @@ QUnit.module('Views', { calendar.destroy(); }); + QUnit.test('set event as all day when field is date (without all_day mapping)', async function (assert) { + assert.expect(1); + + this.data.event.records[0].start_date = "2016-12-14"; + + var calendar = await createCalendarView({ + View: CalendarView, + model: 'event', + data: this.data, + arch: ``, + archs: archs, + viewOptions: { + initialDate: initialDate, + }, + }); + assert.containsOnce(calendar, '.fc-day-grid .fc-event-container', + "should be one event in the all day row"); + calendar.destroy(); + }); + QUnit.test('quickcreate avoid double event creation', async function (assert) { assert.expect(1); var createCount = 0;