From ff70012c05deb7325527578577a4720010e38e8e Mon Sep 17 00:00:00 2001 From: Pablo Date: Thu, 6 Dec 2018 08:49:37 +0100 Subject: [PATCH] [ADD] Show out of service reason --- .../models/inherited_hotel_reservation.py | 10 +++++--- .../views/calendar/hotel_calendar_renderer.js | 4 ++- .../src/xml/hotel_calendar_templates.xml | 25 ++++++++++++------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py index a40cbe4da..1f6ec99b4 100644 --- a/hotel_calendar/models/inherited_hotel_reservation.py +++ b/hotel_calendar/models/inherited_hotel_reservation.py @@ -21,7 +21,8 @@ class HotelReservation(models.Model): json_reservations.append([ reserv.room_id.id, reserv.id, - reserv.folio_id.partner_id.name, + reserv.folio_id.closure_reason_id.name or _('Out of service') if reserv.folio_id.reservation_type == 'out' + else reserv.folio_id.partner_id.name, reserv.adults, reserv.children, reserv.checkin, @@ -47,12 +48,15 @@ class HotelReservation(models.Model): ]) json_reservation_tooltips.update({ reserv.id: [ - reserv.folio_id.partner_id.name, + _('Out of service') if reserv.folio_id.reservation_type == 'out' else reserv.folio_id.partner_id.name, reserv.folio_id.partner_id.mobile or reserv.folio_id.partner_id.phone or _('Undefined'), reserv.checkin, num_split, - reserv.folio_id.amount_total] + reserv.folio_id.amount_total, + reserv.reservation_type, + reserv.out_service_description or _('No reason given'), + ] }) return (json_reservations, json_reservation_tooltips) diff --git a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js index 248e5370d..b3f54e498 100644 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js +++ b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js @@ -67,7 +67,9 @@ var HotelCalendarView = AbstractRenderer.extend({ 'phone': tp[1], 'arrival_hour': HotelCalendar.toMomentUTC(tp[2], HotelConstants.ODOO_DATETIME_MOMENT_FORMAT).local().format('HH:mm'), 'num_split': tp[3], - 'amount_total': Number(tp[4]).toLocaleString() + 'amount_total': Number(tp[4]).toLocaleString(), + 'reservation_type': tp[5], + 'out_service_description': tp[6] }; }, diff --git a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml b/hotel_calendar/static/src/xml/hotel_calendar_templates.xml index eeb8195b4..ba0d55bee 100644 --- a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml +++ b/hotel_calendar/static/src/xml/hotel_calendar_templates.xml @@ -70,15 +70,22 @@
- + +
    +
  • Phone:
  • +
  • Arrival Hour:
  • + +
  • Splitted:
  • +
    + +
  • Total Amount:
  • +
+
+ +
    +
  • Reason:
  • +
+