mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] wubook import methods
This commit is contained in:
@@ -38,7 +38,7 @@ class HotelRoomTypeRestrictionImporter(Component):
|
|||||||
else:
|
else:
|
||||||
plan_bind.with_context({'connector_no_export':True}).write(
|
plan_bind.with_context({'connector_no_export':True}).write(
|
||||||
plan_record.values())
|
plan_record.values())
|
||||||
self.binder(str(plan['id']), plan_bind)
|
self.binder.bind(str(plan['id']), plan_bind)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
return count
|
return count
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class HotelRoomTypeRestrictionImporter(Component):
|
|||||||
model_name='channel.hotel.room.type.restriction.item')
|
model_name='channel.hotel.room.type.restriction.item')
|
||||||
_logger.info("==[CHANNEL->ODOO]==== RESTRICTIONS ==")
|
_logger.info("==[CHANNEL->ODOO]==== RESTRICTIONS ==")
|
||||||
_logger.info(plan_restrictions)
|
_logger.info(plan_restrictions)
|
||||||
|
import wdb; wdb.set_trace()
|
||||||
count = 0
|
count = 0
|
||||||
for k_rpid, v_rpid in plan_restrictions.items():
|
for k_rpid, v_rpid in plan_restrictions.items():
|
||||||
channel_restriction_id = channel_reserv_restriction_obj.search([
|
channel_restriction_id = channel_reserv_restriction_obj.search([
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
from odoo.addons.component.core import Component
|
from odoo.addons.component.core import Component
|
||||||
from odoo.addons.connector.components.mapper import mapping
|
from odoo.addons.connector.components.mapper import mapping
|
||||||
from odoo.addons.hotel_channel_connector.components.core import ChannelConnectorError
|
from odoo.addons.hotel_channel_connector.components.core import ChannelConnectorError
|
||||||
from odoo import api
|
from odoo import api, _
|
||||||
|
|
||||||
|
|
||||||
class ProductPricelistImporter(Component):
|
class ProductPricelistImporter(Component):
|
||||||
@@ -40,7 +40,7 @@ class ProductPricelistImporter(Component):
|
|||||||
plan_bind.with_context({
|
plan_bind.with_context({
|
||||||
'connector_no_export': True,
|
'connector_no_export': True,
|
||||||
}).write(plan_record.values())
|
}).write(plan_record.values())
|
||||||
self.binder(str(plan['id']), plan_bind)
|
self.binder.bind(str(plan['id']), plan_bind)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
return count
|
return count
|
||||||
|
|
||||||
@@ -53,9 +53,19 @@ class ProductPricelistImportMapper(Component):
|
|||||||
direct = [
|
direct = [
|
||||||
('id', 'external_id'),
|
('id', 'external_id'),
|
||||||
('name', 'name'),
|
('name', 'name'),
|
||||||
('daily', 'is_daily_plan'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@mapping
|
@mapping
|
||||||
def backend_id(self, record):
|
def backend_id(self, record):
|
||||||
return {'backend_id': self.backend_record.id}
|
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': '',
|
||||||
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user