From 59adf3d160eb217923309c79c73e9023ba82b96a Mon Sep 17 00:00:00 2001 From: Pablo Date: Fri, 22 Feb 2019 12:26:04 +0100 Subject: [PATCH] [ADD] channel availability bus notification --- .../static/src/lib/hcalendar/js/hcalendar_management.js | 5 ++++- .../models/inherited_bus_hotel_calendar.py | 1 + .../models/inherited_hotel_room_type_availability.py | 1 + .../src/js/views/hotel_calendar_management_controller.js | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js index 31f834549..aa76910cf 100644 --- a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js +++ b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js @@ -783,6 +783,8 @@ HotelCalendarManagement.prototype = { var inputMaxAvail = this.etable.querySelector(`#${inputMaxAvailId}`); var inputNoOTAId = this._sanitizeId(`NO_OTA_${room.id}_${ndateStr}`); var inputNoOTA = this.etable.querySelector(`#${inputNoOTAId}`); + var inputChannelAvailId = this._sanitizeId(`CHANNEL_AVAIL_${room.id}_${ndateStr}`); + var inputChannelAvail = this.etable.querySelector(`#${inputChannelAvailId}`); if (!onlyNew || (onlyNew && (inputQuota.value !== inputQuota.dataset.orgValue || inputMaxAvail.value !== inputMaxAvail.dataset.orgValue @@ -792,7 +794,8 @@ HotelCalendarManagement.prototype = { 'date': ndate.format('YYYY-MM-DD'), 'quota': inputQuota.value, 'max_avail': inputMaxAvail.value, - 'no_ota': Boolean(inputNoOTA.dataset.state === 'true') || false + 'no_ota': Boolean(inputNoOTA.dataset.state === 'true') || false, + 'channel_avail': inputChannelAvail.value, }); } } diff --git a/hotel_calendar_channel_connector/models/inherited_bus_hotel_calendar.py b/hotel_calendar_channel_connector/models/inherited_bus_hotel_calendar.py index 3f17225ec..b1cafb2ac 100644 --- a/hotel_calendar_channel_connector/models/inherited_bus_hotel_calendar.py +++ b/hotel_calendar_channel_connector/models/inherited_bus_hotel_calendar.py @@ -42,6 +42,7 @@ class BusHotelCalendar(models.TransientModel): 'max_avail': vals['max_avail'], 'id': vals['id'], 'no_ota': vals['no_ota'], + 'channel_avail': vals['channel_avail'], }, }, }, diff --git a/hotel_calendar_channel_connector/models/inherited_hotel_room_type_availability.py b/hotel_calendar_channel_connector/models/inherited_hotel_room_type_availability.py index 8be516f90..d9a5492ed 100644 --- a/hotel_calendar_channel_connector/models/inherited_hotel_room_type_availability.py +++ b/hotel_calendar_channel_connector/models/inherited_hotel_room_type_availability.py @@ -14,6 +14,7 @@ class HotelRoomTypeAvailability(models.Model): 'max_avail': record.max_avail, 'room_type_id': record.room_type_id.id, 'id': record.id, + 'channel_avail': record.channel_bind_ids.channel_avail, } @api.model diff --git a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_controller.js b/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_controller.js index f3e8f6880..89ed396e2 100644 --- a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_controller.js +++ b/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_controller.js @@ -30,7 +30,8 @@ var MPMSCalendarController = MPMSCalendarController.include({ 'quota': avail[room_type][day]['quota'], 'max_avail': avail[room_type][day]['max_avail'], 'no_ota': avail[room_type][day]['no_ota'], - 'id': avail[room_type][day]['id'] + 'id': avail[room_type][day]['id'], + 'channel_avail': avail[room_type][day]['channel_avail'] }]; this.renderer._hcalendar.addAvailability(availability); break;