From 0ab1c2faa0517d6e58bb32319061bde725fc7c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=C3=ADaz?= Date: Sun, 13 Jan 2019 15:47:07 +0100 Subject: [PATCH] [FIX] Calendar Reservation Draw --- hotel_calendar/models/inherited_hotel_reservation.py | 7 +++++-- hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py index 07ba1134e..b5f4d0321 100644 --- a/hotel_calendar/models/inherited_hotel_reservation.py +++ b/hotel_calendar/models/inherited_hotel_reservation.py @@ -181,12 +181,15 @@ class HotelReservation(models.Model): rdfrom_dt = dfrom_dt + timedelta(days=1) # Ignore checkout reservations_raw = self.env['hotel.reservation'].search([ ('room_id', 'in', rooms.ids), - '|', '&', + '|', '|', '&', ('checkin', '<=', dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), ('checkout', '>=', rdfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), '&', + ('checkin', '<=', dfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), + ('checkout', '>=', dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), + '&', ('checkin', '>=', dfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), - ('checkout', '<=', dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)) + ('checkout', '<=', dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), ], order="checkin DESC, checkout ASC, adults DESC, children DESC") return self._hcalendar_reservation_data(reservations_raw) diff --git a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js index 501ce1b02..2b724d957 100644 --- a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js +++ b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js @@ -82,7 +82,7 @@ function HotelCalendar(/*String*/querySelector, /*Dictionary*/options, /*List*/p this._reservationsMap = {}; // Store Reservations Mapped by Room for Search Purposes this._modeSwap = HotelCalendar.MODE.NONE; // Store Swap Mode this._selectionMode = HotelCalendar.MODE.NONE; - this._endDate = this.options.startDate.clone().add(this.options.days+1, 'd'); // Store End Calendar Day + this._endDate = this.options.startDate.clone().add(this.options.days, 'd'); // Store End Calendar Day this._tableCreated = false; // Store Flag to Know Calendar Creation this._cellSelection = {start:false, end:false, current:false}; // Store Info About Selected Cells this._lazyModeReservationsSelection = false; // Store Info About Timer for Selection Action @@ -152,7 +152,7 @@ HotelCalendar.prototype = { this.options.orig_days = days; this.options.days = this.parseDays(days) + 1; } - this._endDate = this.options.startDate.clone().add(this.options.days+1, 'd'); + this._endDate = this.options.startDate.clone().add(this.options.days, 'd'); /*this.e.dispatchEvent(new CustomEvent( 'hcOnChangeDate',