diff --git a/hotel_calendar/models/bus_hotel_calendar.py b/hotel_calendar/models/bus_hotel_calendar.py index 5ae1ac6a6..2bb4d5289 100644 --- a/hotel_calendar/models/bus_hotel_calendar.py +++ b/hotel_calendar/models/bus_hotel_calendar.py @@ -24,7 +24,7 @@ class BusHotelCalendar(models.TransientModel): def _generate_reservation_notif(self, vals): user_id = self.env['res.users'].browse(self.env.uid) master_reserv = vals['parent_reservation'] or vals['reserv_id'] - num_split = self.env['hotel.reservation'].search_count([ + reserv_chunks = self.env['hotel.reservation'].search_count([ ('folio_id', '=', vals['folio_id']), '|', ('parent_reservation', '=', master_reserv), ('id', '=', master_reserv), @@ -69,7 +69,7 @@ class BusHotelCalendar(models.TransientModel): 'checkout': vals['checkout'], 'arrival_hour': vals['arrival_hour'], 'departure_hour': vals['departure_hour'], - 'num_split': num_split, + 'reserv_chunks': reserv_chunks, 'amount_total': vals['amount_total'], 'pending_amount': vals['pending_amount'], 'amount_paid': vals['amount_paid'], diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py index b32bfcdde..30950071d 100644 --- a/hotel_calendar/models/inherited_hotel_reservation.py +++ b/hotel_calendar/models/inherited_hotel_reservation.py @@ -93,6 +93,15 @@ class HotelReservation(models.Model): 'overbooking': reserv['overbooking'], 'state': reserv['state'], 'real_dates': [reserv['real_checkin'], reserv['real_checkout']]}) + reserv_chunks = 1 + if reserv['splitted']: + master_reserv = reserv['parent_reservation'] or reserv['folio_id'] + reserv_chunks = self.search_count([ + ('folio_id', '=', reserv['folio_id']), + '|', ('parent_reservation', '=', master_reserv), + ('id', '=', master_reserv), + ('splitted', '=', True), + ]) json_reservation_tooltips.update({ reserv['id']: { 'folio_name': reserv['folio_id'], @@ -115,9 +124,12 @@ class HotelReservation(models.Model): 'type': reserv['reservation_type'] or 'normal', 'out_service_description': reserv['out_service_description'] or _('No reason given'), + 'splitted': reserv['splitted'], + 'reserv_chunks': reserv_chunks, # TODO: Add Board Services and Extra Service as Cradle, Bed, ... } }) + return (json_reservations, json_reservation_tooltips) @api.model 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 ba1b41648..af954f15a 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 @@ -756,7 +756,8 @@ var PMSCalendarController = AbstractController.extend({ 'pending_amount': Number(tp['pending_amount']).toLocaleString(), 'amount_paid': Number(tp['amount_paid']).toLocaleString(), 'reservation_type': tp['type'], - 'out_service_description': tp['out_service_description'] + 'out_service_description': tp['out_service_description'], + 'reserv_chunks': tp['reserv_chunks'], }; }, diff --git a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml b/hotel_calendar/static/src/xml/hotel_calendar_templates.xml index 9c123b221..2f405c753 100644 --- a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml +++ b/hotel_calendar/static/src/xml/hotel_calendar_templates.xml @@ -121,6 +121,11 @@ title="Close" /> +
+ + This reservation has been splitted in chunks. + +
@@ -136,7 +141,7 @@

Total Paid

- +