From ed9ffcb31ee2d28006b4a7558cf5617135df7c50 Mon Sep 17 00:00:00 2001 From: Pablo Date: Tue, 22 Jan 2019 18:50:39 +0100 Subject: [PATCH] [FIX] Use real_dates for showing correct checkin/checkout in splitted reservation --- hotel_calendar/models/bus_hotel_calendar.py | 1 + hotel_calendar/models/inherited_hotel_reservation.py | 1 + .../src/js/views/calendar/hotel_calendar_controller.js | 8 ++++---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hotel_calendar/models/bus_hotel_calendar.py b/hotel_calendar/models/bus_hotel_calendar.py index 532a49b9d..1b2b54dad 100644 --- a/hotel_calendar/models/bus_hotel_calendar.py +++ b/hotel_calendar/models/bus_hotel_calendar.py @@ -68,6 +68,7 @@ class BusHotelCalendar(models.TransientModel): 'type': vals['reservation_type'], 'out_service_description': vals['out_service_description'], 'splitted': vals['splitted'], + 'real_dates': vals['real_dates'], 'channel_type': vals['channel_type'], } } diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py index 4ff64aa93..cfc94a7b8 100644 --- a/hotel_calendar/models/inherited_hotel_reservation.py +++ b/hotel_calendar/models/inherited_hotel_reservation.py @@ -117,6 +117,7 @@ class HotelReservation(models.Model): or _('No reason given'), 'splitted': reserv['splitted'], 'channel_type': reserv['channel_type'], + 'real_dates': [reserv['real_checkin'], reserv['real_checkout']], # TODO: Add Board Services and Extra Service as Cradle, Bed, ... } }) diff --git a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js index 4f19fba16..80cf84cd8 100644 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js +++ b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js @@ -746,10 +746,10 @@ var PMSCalendarController = AbstractController.extend({ 'room_type_name': tp['room_type_name'], 'adults': tp['adults'], 'children': tp['children'], - 'checkin': HotelCalendar.toMomentUTC(tp['checkin'], '').format("DD MMMM"), - 'checkin_day_of_week': HotelCalendar.toMomentUTC(tp['checkin'], '').format("dddd"), - 'checkout': HotelCalendar.toMomentUTC(tp['checkout'], '').format("DD MMMM"), - 'checkout_day_of_week': HotelCalendar.toMomentUTC(tp['checkout'], '').format("dddd"), + 'checkin': HotelCalendar.toMomentUTC(tp['real_dates'][0], '').format("DD MMMM"), + 'checkin_day_of_week': HotelCalendar.toMomentUTC(tp['real_dates'][0], '').format("dddd"), + 'checkout': HotelCalendar.toMomentUTC(tp['real_dates'][1], '').format("DD MMMM"), + 'checkout_day_of_week': HotelCalendar.toMomentUTC(tp['real_dates'][1], '').format("dddd"), 'arrival_hour': tp['arrival_hour'], 'departure_hour': tp['departure_hour'], 'amount_total': Number(tp['amount_total']).toLocaleString(),