diff --git a/hotel_channel_connector_wubook/models/hotel_room_type_restriction/importer.py b/hotel_channel_connector_wubook/models/hotel_room_type_restriction/importer.py index dd507321e..cbfd04973 100644 --- a/hotel_channel_connector_wubook/models/hotel_room_type_restriction/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_room_type_restriction/importer.py @@ -38,7 +38,7 @@ class HotelRoomTypeRestrictionImporter(Component): else: plan_bind.with_context({'connector_no_export':True}).write( plan_record.values()) - self.binder(str(plan['id']), plan_bind) + self.binder.bind(str(plan['id']), plan_bind) count = count + 1 return count diff --git a/hotel_channel_connector_wubook/models/hotel_room_type_restriction_item/importer.py b/hotel_channel_connector_wubook/models/hotel_room_type_restriction_item/importer.py index 842a34d1b..d2be6b573 100644 --- a/hotel_channel_connector_wubook/models/hotel_room_type_restriction_item/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_room_type_restriction_item/importer.py @@ -27,6 +27,7 @@ class HotelRoomTypeRestrictionImporter(Component): model_name='channel.hotel.room.type.restriction.item') _logger.info("==[CHANNEL->ODOO]==== RESTRICTIONS ==") _logger.info(plan_restrictions) + import wdb; wdb.set_trace() count = 0 for k_rpid, v_rpid in plan_restrictions.items(): channel_restriction_id = channel_reserv_restriction_obj.search([ diff --git a/hotel_channel_connector_wubook/models/product_pricelist/importer.py b/hotel_channel_connector_wubook/models/product_pricelist/importer.py index 34dee1acb..6a8562a4d 100644 --- a/hotel_channel_connector_wubook/models/product_pricelist/importer.py +++ b/hotel_channel_connector_wubook/models/product_pricelist/importer.py @@ -4,7 +4,7 @@ from odoo.addons.component.core import Component from odoo.addons.connector.components.mapper import mapping from odoo.addons.hotel_channel_connector.components.core import ChannelConnectorError -from odoo import api +from odoo import api, _ class ProductPricelistImporter(Component): @@ -40,7 +40,7 @@ class ProductPricelistImporter(Component): plan_bind.with_context({ 'connector_no_export': True, }).write(plan_record.values()) - self.binder(str(plan['id']), plan_bind) + self.binder.bind(str(plan['id']), plan_bind) count = count + 1 return count @@ -53,9 +53,19 @@ class ProductPricelistImportMapper(Component): direct = [ ('id', 'external_id'), ('name', 'name'), - ('daily', 'is_daily_plan'), ] @mapping def backend_id(self, record): return {'backend_id': self.backend_record.id} + + @mapping + def pricelist_type(self, record): + if record['daily'] == 1: + return {'pricelist_type': 'daily'} + else: + # TODO: manage not daily plans in Hootel + raise ChannelConnectorError(_("Can't map a pricing plan from wubook"), { + 'message': '', + }) +