From 349a71922f06f1ab807d8ffa67283bddbcffd609 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 18 Mar 2019 10:23:05 +0100 Subject: [PATCH 1/5] [FIX] Wrong Fix. `men` is used for _all_ adults in the booked rooms --- .../models/hotel_reservation/importer.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py index 7648286f1..dc7c2c044 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py @@ -99,8 +99,6 @@ class HotelReservationImporter(Component): split_booking, dates_checkin, dates_checkout, real_checkin, real_checkout, book): is_cancellation = book['status'] in WUBOOK_STATUS_BAD tax_inclusive = True - # men = Number of adults (when not defined, equal to -1) - persons = book.get('men', -1) > -1 and book.get('men') or room_type_bind.ota_capacity # Dates real_checkin_str = real_checkin.strftime( DEFAULT_SERVER_DATETIME_FORMAT) From ea992d6c2d1cf8112d5c86c59d35e215d8de4831 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 18 Mar 2019 10:26:40 +0100 Subject: [PATCH 2/5] [FIX] Wrong Fix. Roll back to ota_capacity by default --- .../models/hotel_reservation/importer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py index dc7c2c044..b5237880c 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py @@ -99,6 +99,7 @@ class HotelReservationImporter(Component): split_booking, dates_checkin, dates_checkout, real_checkin, real_checkout, book): is_cancellation = book['status'] in WUBOOK_STATUS_BAD tax_inclusive = True + persons = room_type_bind.ota_capacity # Dates real_checkin_str = real_checkin.strftime( DEFAULT_SERVER_DATETIME_FORMAT) From 08975710b3e0cfcbd32bfa57b538688e1134d10a Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 18 Mar 2019 11:02:22 +0100 Subject: [PATCH 3/5] [FIX] Use rooms_occupancy for number of adults before search for `guest` key --- .../models/hotel_reservation/importer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py index b5237880c..08ec42730 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py @@ -100,6 +100,10 @@ class HotelReservationImporter(Component): is_cancellation = book['status'] in WUBOOK_STATUS_BAD tax_inclusive = True persons = room_type_bind.ota_capacity + # Info about the occupancy of each booked room (it can be empty) + occupancy = next((item for item in book['rooms_occupancies'] if item["id"] == broom['room_id']), False) + if occupancy: + persons = occupancy['occupancy'] # Dates real_checkin_str = real_checkin.strftime( DEFAULT_SERVER_DATETIME_FORMAT) From f2ca889222a8478779d28c89702cd5241b5382db Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 18 Mar 2019 11:23:24 +0100 Subject: [PATCH 4/5] [WIP] TODO: Review where to check the total room amount --- .../models/hotel_reservation/common.py | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/common.py b/hotel_channel_connector_wubook/models/hotel_reservation/common.py index 09abf6a0f..4eca1f94f 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/common.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/common.py @@ -28,23 +28,23 @@ class ChannelHotelReservation(models.Model): (str(WUBOOK_STATUS_CANCELLED_PENALTY), 'Cancelled with penalty'), ]) - @api.model - def create(self, vals): - # TODO FIX: RuntimeError: RuntimeError('super(): no arguments',) ¿? - record = super(ChannelHotelReservation, self).create(vals) - if record.channel_total_amount != record.odoo_id.price_room_services_set: - record.odoo_id.unconfirmed_channel_price = True - self.env['hotel.channel.connector.issue'].create({ - 'backend_id': record.backend_id.id, - 'section': 'reservation', - 'internal_message': "Disagreement in reservation price. Odoo marked %.2f whereas the channel sent %.2f." % ( - record.odoo_id.price_room_services_set, - record.channel_total_amount), - 'channel_message': 'Please, review the board services included in the reservation.', - 'channel_object_id': record.external_id - }) - - return record + # TODO: Review where to check the total room amount + # @api.model + # def create(self, vals): + # record = super(ChannelHotelReservation, self).create(vals) + # if record.channel_total_amount != record.odoo_id.price_room_services_set: + # record.odoo_id.unconfirmed_channel_price = True + # self.env['hotel.channel.connector.issue'].create({ + # 'backend_id': record.backend_id.id, + # 'section': 'reservation', + # 'internal_message': "Disagreement in reservation price. Odoo marked %.2f whereas the channel sent %.2f." % ( + # record.odoo_id.price_room_services_set, + # record.channel_total_amount), + # 'channel_message': 'Please, review the board services included in the reservation.', + # 'channel_object_id': record.external_id + # }) + # + # return record class HotelReservation(models.Model): From 9ae708e94f2da8ddb7019ad0eaae1a23bb8f6bcf Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 18 Mar 2019 13:25:14 +0100 Subject: [PATCH 5/5] [FIX] unfix... occupancy includes children... --- .../models/hotel_reservation/importer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py index 08ec42730..002742396 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py @@ -101,9 +101,10 @@ class HotelReservationImporter(Component): tax_inclusive = True persons = room_type_bind.ota_capacity # Info about the occupancy of each booked room (it can be empty) - occupancy = next((item for item in book['rooms_occupancies'] if item["id"] == broom['room_id']), False) - if occupancy: - persons = occupancy['occupancy'] + # BUG: occupancy includes children... Review adults by OTA + # occupancy = next((item for item in book['rooms_occupancies'] if item["id"] == broom['room_id']), False) + # if occupancy: + # persons = occupancy['occupancy'] # Dates real_checkin_str = real_checkin.strftime( DEFAULT_SERVER_DATETIME_FORMAT)