diff options
| author | Romeo Fragomeli <rfr@odoo.com> | 2020-05-25 09:41:14 +0000 |
|---|---|---|
| committer | Romeo Fragomeli <rfr@odoo.com> | 2020-05-25 13:54:55 +0000 |
| commit | 2adaeb589b0116b8f76f76f9c257b58786a7fabe (patch) | |
| tree | 1725dee6490c42d5d33e1a6597015fea3d31254f | |
| parent | e03a87ae08ab24190f2ed023db24b59fa8bf4b11 (diff) | |
[FIX] web: deadlines are not visible in day/week calendar views
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) <adr@odoo.com>
Signed-off-by: rfr-odoo <rfr-odoo@users.noreply.github.com>
| -rw-r--r-- | addons/web/static/src/js/views/calendar/calendar_model.js | 2 | ||||
| -rw-r--r-- | addons/web/static/tests/views/calendar_tests.js | 20 |
2 files changed, 21 insertions, 1 deletions
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: `<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; |
