From e9d142961d7dd9366e862c29f3eb397345f92dc5 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 22 Apr 2019 19:12:44 +0200 Subject: [PATCH 1/2] [FIX] remove Toggle Advance Controls --- .../js/views/calendar/hotel_calendar_view.js | 18 ------------------ .../src/xml/hotel_calendar_templates.xml | 8 +++----- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_view.js b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_view.js index 1c2b5c7a6..d95848e3a 100644 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_view.js +++ b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_view.js @@ -92,24 +92,6 @@ var CalendarMenu = Widget.extend({ return $.when(); }, - toggle_show_adv_controls: function() { - var $pms_search = $(document).find('#pms-search'); - if ($pms_search.position().top < 0) - { - var $navbar = $('.navbar'); - var toPos = $navbar.height() + parseInt($navbar.css('border-top-width'), 10) + parseInt($navbar.css('border-bottom-width'), 10); - $pms_search.animate({ - 'top': `${toPos}px`, - 'opacity': 1.0, - }, 'fast'); - } else { - $pms_search.animate({ - 'top': `-${$pms_search.height()}px`, - 'opacity': 0.0, - }, 'slow'); - } - }, - toggle_show_notification: function() { this._show_notifications = !this._show_notifications; this._rpc({ diff --git a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml b/hotel_calendar/static/src/xml/hotel_calendar_templates.xml index 0d6d10704..49bddb9a5 100644 --- a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml +++ b/hotel_calendar/static/src/xml/hotel_calendar_templates.xml @@ -370,12 +370,10 @@ -
  • Toggle Advance Controls
  • -
  • Show Notifications
  • -
  • Show Pricelist
  • -
  • Show Availability
  • -
  • Divide Rooms by Capacity
  • +
  • Show Pricelist
  • +
  • Show Availability
  • +
  • Divide Rooms by Capacity
  • From 9649b2908d54aa430fb9522a9c71a73dc395e083 Mon Sep 17 00:00:00 2001 From: Pablo Date: Tue, 23 Apr 2019 07:49:44 +0200 Subject: [PATCH 2/2] [FIX] skip cancelled reservation in availability checks --- hotel/models/hotel_reservation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hotel/models/hotel_reservation.py b/hotel/models/hotel_reservation.py index ee9238ffa..27385364a 100644 --- a/hotel/models/hotel_reservation.py +++ b/hotel/models/hotel_reservation.py @@ -755,7 +755,7 @@ class HotelReservation(models.Model): def onchange_room_availabiltiy_domain(self): self.ensure_one() if self.checkin and self.checkout: - if self.overbooking or self.reselling: + if self.overbooking or self.reselling or self.state in ('cancelled'): return occupied = self.env['hotel.reservation'].get_reservations( self.checkin, @@ -1155,7 +1155,9 @@ class HotelReservation(models.Model): if fields.Date.from_string(self.checkin) >= fields.Date.from_string(self.checkout): raise ValidationError(_('Room line Check In Date Should be \ less than the Check Out Date!')) - if not self.overbooking and not self._context.get("ignore_avail_restrictions", False): + if not self.overbooking \ + and self.state not in ('cancelled') \ + and not self._context.get("ignore_avail_restrictions", False): occupied = self.env['hotel.reservation'].get_reservations( self.checkin, (fields.Date.from_string(self.checkout) - timedelta(days=1)).