[FIX] web: moving non-all day events

In a view month of calendar, when moving a non-all day event from a date
A to a date B.

Before this commit, the event will be changed to an all day event type.

Now, the event will be staid unchanged, only the date will be updated.

opw-2093111

X-original-commit: df001af5341bf35f36fe455d69bbb46f4b0fa00c
Co-authored-by: Nicolas Lempereur <nle@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2019-11-14 15:09:12 +00:00
committed by fw-bot
co-authored by Nicolas Lempereur
parent 03e44375fe
commit a5702a1ff1
@@ -65,10 +65,11 @@ return AbstractModel.extend({
}
var isDateEvent = this.fields[this.mapping.date_start].type === 'date';
var keepRecordTime = !this.mapping.all_day || (this.data.scale === 'month' && event.record && !event.record[this.mapping.all_day]);
// An "allDay" event without the "all_day" option is not considered
// as a 24h day. It's just a part of the day (by default: 7h-19h).
if (event.allDay) {
if (!this.mapping.all_day && !isDateEvent) {
if (keepRecordTime && !isDateEvent) {
if (event.r_start) {
start.hours(event.r_start.hours())
.minutes(event.r_start.minutes())
@@ -94,7 +95,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;