diff options
| author | Romeo Fragomeli <rfr@odoo.com> | 2020-03-18 09:19:05 +0000 |
|---|---|---|
| committer | Pierre Paridans <app@odoo.com> | 2020-03-31 15:09:18 +0000 |
| commit | 7b815c3bf28db3625c4d377eab6aec90867825be (patch) | |
| tree | e7a99087f2f11218504e5ccac82f47d9a3c9d64c /addons/web/static/src/js | |
| parent | d57470387aa1a155e004aaebec7b8b66de581dcd (diff) | |
[FIX] web: calendar's drag-and-dropped event has wrong end-date
Due to previous commit, in month view, the flag marking events as "all
day" is no more present and so some logic is not applied anymore. This
results into the wrong end-date.
With this commit we avoid to change the end date of an event in
FullCalendar.
Note that it changes the behavior on drag-and-dropped event in month
view:
* Before both the last and this commit, an event if 1H will become an
"all day" event when it's dropped into another cell.
* After them, the time will be the same as the original event and only
the date will change.
Also, one test was already added in commit odoo/odoo@7af13089dffcd3c9d98716af4aa76b923825fdfc
to check that, in month view, when we move a non-"all day" event to
another day, it can't change into a all day event.
This commit adds a second test to cover the case when the "all day"
mapping is present.
Task ID: 2183249
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/views/calendar/calendar_model.js | 15 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/calendar/calendar_renderer.js | 1 |
2 files changed, 2 insertions, 14 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 caa1d26e8c6..20c067d2ccc 100644 --- a/addons/web/static/src/js/views/calendar/calendar_model.js +++ b/addons/web/static/src/js/views/calendar/calendar_model.js @@ -94,7 +94,7 @@ return AbstractModel.extend({ if (this.mapping.all_day) { if (event.record) { data[this.mapping.all_day] = - (this.scale !== 'month' && event.allDay) || + (this.data.scale !== 'month' && event.allDay) || event.record[this.mapping.all_day] && end.diff(start) < 10 || false; @@ -758,18 +758,7 @@ return AbstractModel.extend({ 'attendees':attendees, }; - if (this.mapping.all_day && evt[this.mapping.all_day]) { - // r.start = date_start.format('YYYY-MM-DD'); - // r.end = date_stop.format('YYYY-MM-DD'); - } else if (this.data.scale === 'month' && this.fields[this.mapping.date_start].type !== 'date') { - // In month, FullCalendar gives the end day as the - // next day at midnight (instead of 23h59). - date_stop.add(1, 'days'); - - // allow to resize in month mode - r.reset_allday = r.allDay; - r.start = date_start.toDate(); - r.end = date_stop.startOf('day').toDate(); + if (!(this.mapping.all_day && evt[this.mapping.all_day]) && this.data.scale === 'month' && this.fields[this.mapping.date_start].type !== 'date') { r.showTime = true; } diff --git a/addons/web/static/src/js/views/calendar/calendar_renderer.js b/addons/web/static/src/js/views/calendar/calendar_renderer.js index f6ae085e81a..4f492585ef1 100644 --- a/addons/web/static/src/js/views/calendar/calendar_renderer.js +++ b/addons/web/static/src/js/views/calendar/calendar_renderer.js @@ -338,7 +338,6 @@ return AbstractRenderer.extend({ event = Object.assign({}, event, { r_start: fc4Event.extendedProps.r_start && moment(fc4Event.extendedProps.r_start).utcOffset(0, true), r_end: fc4Event.extendedProps.r_end && moment(fc4Event.extendedProps.r_end).utcOffset(0, true), - reset_allday: fc4Event.extendedProps.reset_allday, record: fc4Event.extendedProps.record, attendees: fc4Event.extendedProps.attendees, }); |
