From 8cd6cd0989bdeada1cd8e0e84efa307270b97dfd Mon Sep 17 00:00:00 2001 From: Dario Lodeiros Date: Tue, 13 Aug 2019 15:22:36 +0200 Subject: [PATCH] [FIX] Force update avail on splitted sections imported --- .../models/hotel_reservation/importer.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py index bf2624da0..2eacd7a67 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py @@ -653,9 +653,21 @@ class HotelReservationImporter(Component): for rline in rlines: for rline_bind in rline.channel_bind_ids: self.binder.bind(rline_bind.external_id, rline_bind) - # TODO: Imp refactoring method + # TODO: Imp importer, refactoring method # Force to_assign = true (fix the to_assign splitted reservations) rline.update({'to_assign': True}) + # Force to update avail on splitteds sections + if rline.parent_reservation: + # This break with multi channels by room type + backend_id = self.env['channel.hotel.room.type'].search([ + ('odoo_id', '=', rline.room_type_id.id) + ]).backend_id + self.env['channel.hotel.room.type.availability'].sudo().refresh_availability( + checkin=rline.real_checkin, + checkout=rline.real_checkout, + backend_id=backend_id.id, + room_type_id=rline.room_type_id.id, + from_channel=True,) processed_rids.append(rcode) return (processed_rids, any(failed_reservations),