diff --git a/hotel_channel_connector_wubook/models/channel_backend/common.py b/hotel_channel_connector_wubook/models/channel_backend/common.py index 3c3197d30..db7f59134 100644 --- a/hotel_channel_connector_wubook/models/channel_backend/common.py +++ b/hotel_channel_connector_wubook/models/channel_backend/common.py @@ -22,10 +22,16 @@ class ChannelBackend(models.Model): def _get_default_server(self): return 'https://wired.wubook.net/xrws/' + def _get_default_wubook_parity(self): + return self.env['ir.default'].sudo().get('res.config.settings', 'default_pricelist_id') + lcode = fields.Char('Channel Service lcode') pkey = fields.Char('Channel Service PKey') server = fields.Char('Channel Service Server', default=_get_default_server) + wubook_parity_pricelist_id = fields.Many2one('product.pricelist', 'WuBook Parity Pricelist', + required=True, + default=_get_default_wubook_parity) @contextmanager @api.multi diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py index e05277326..b8c81b667 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py @@ -121,6 +121,8 @@ class HotelReservationImporter(Component): if 'tax_inclusive' in broom['ancillary'] and not broom['ancillary']['tax_inclusive']: _logger.info("--- Incoming Reservation without taxes included!") tax_inclusive = False + # rate_id ( 0: WuBook Parity (aka standard rate); > 0: the id of the booked pricing plan) + rate_id = 0 # Generate Reservation Day Lines reservation_lines = [] tprice = 0.0 @@ -141,6 +143,11 @@ class HotelReservationImporter(Component): 'price': room_day_price, })) tprice += room_day_price + rate_id = brday['rate_id'] + # TODO: Review different pricelist in the different booked rooms (folio in Odoo) + rate_id = rate_id > 0 and rate_id or self.env['channel.backend'].sudo().search([ + ('id', '=', self.backend_record.id) + ]).wubook_parity_pricelist_id # Get OTA ota_id = self.env['channel.ota.info'].search([ ('backend_id', '=', self.backend_record.id), @@ -163,6 +170,7 @@ class HotelReservationImporter(Component): 'checkout': checkout_str, 'adults': persons, 'children': book['children'], + 'pricelist_id': rate_id.id, 'reservation_line_ids': reservation_lines, 'to_assign': True, 'state': is_cancellation and 'cancelled' or 'confirm', diff --git a/hotel_channel_connector_wubook/views/inherited_channel_connector_backend_views.xml b/hotel_channel_connector_wubook/views/inherited_channel_connector_backend_views.xml index 4014bed20..b21995300 100644 --- a/hotel_channel_connector_wubook/views/inherited_channel_connector_backend_views.xml +++ b/hotel_channel_connector_wubook/views/inherited_channel_connector_backend_views.xml @@ -9,6 +9,15 @@ + + + + + + + + +