[FIX] web: deadlines are not visible in day/week calendar views

Due to commit odoo/odoo@0150141756
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) <adr@odoo.com>
Signed-off-by: rfr-odoo <rfr-odoo@users.noreply.github.com>
This commit is contained in:
Romeo Fragomeli
2020-05-25 13:54:55 +00:00
parent e03a87ae08
commit 2adaeb589b
2 changed files with 21 additions and 1 deletions
@@ -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',
};
},
/**
@@ -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: `<calendar date_start="start_date" mode="week"></calendar>`,
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;