Merge branch '11.0' of https://github.com/hootel/hootel into 11.0

This commit is contained in:
Dario Lodeiros
2019-03-18 13:27:29 +01:00
2 changed files with 23 additions and 19 deletions

View File

@@ -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):

View File

@@ -99,8 +99,12 @@ 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
persons = room_type_bind.ota_capacity
# Info about the occupancy of each booked room (it can be empty)
# 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)