diff --git a/hotel_channel_connector/models/hotel_reservation/common.py b/hotel_channel_connector/models/hotel_reservation/common.py index b362714d0..ad8ca9e2d 100644 --- a/hotel_channel_connector/models/hotel_reservation/common.py +++ b/hotel_channel_connector/models/hotel_reservation/common.py @@ -133,6 +133,8 @@ class ChannelHotelReservation(models.Model): class HotelReservation(models.Model): _inherit = 'hotel.reservation' + unconfirmed_channel_price = fields.Boolean(related='folio_id.unconfirmed_channel_price') + @api.multi def _set_access_for_channel_fields(self): for record in self: diff --git a/hotel_channel_connector/models/inherited_hotel_folio.py b/hotel_channel_connector/models/inherited_hotel_folio.py index e3f5fb0e4..503b8783d 100644 --- a/hotel_channel_connector/models/inherited_hotel_folio.py +++ b/hotel_channel_connector/models/inherited_hotel_folio.py @@ -19,6 +19,7 @@ class HotelFolio(models.Model): has_channel_reservations = fields.Boolean(compute=_has_channel_reservations, store=False, old_name='whas_wubook_reservations') + unconfirmed_channel_price = fields.Boolean(default=False) @job(default_channel='root.channel') @api.model diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py index 7868f9c19..0fd195369 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py @@ -341,11 +341,21 @@ class HotelReservationImporter(Component): checkout_utc_dt, book, ) + # if vals['price_unit'] != book['amount']: - self.create_issue( - section='reservation', - internal_message="Invalid reservation total price! %.2f (calculated) != %.2f (wubook)" % (vals['price_unit'], book['amount']), - channel_object_id=book['reservation_code']) + bs = self.env['hotel.board.service.room.type'].browse(vals['board_service_room_id']) + price_room_services_set = vals['price_unit'] + (bs.amount * len(broom['roomdays'])) + vals.update({'unconfirmed_channel_price': True}) + # check if difference is owing to misconfigured board services + if price_room_services_set != book['amount']: + internal_reason = 'Please, review the board services included in the reservation.' + self.create_issue( + section='reservation', + internal_message="Invalid reservation total price! %.2f (calculated) != %.2f (wubook) %s" % ( + vals['price_unit'], book['amount'], internal_reason), + channel_object_id=book['reservation_code']) + # TODO: Add other reasons in case of need + free_rooms = room_type_bind.odoo_id.check_availability_room_type( vals['checkin'],