diff --git a/hotel_channel_connector/models/hotel_room_type_restriction/common.py b/hotel_channel_connector/models/hotel_room_type_restriction/common.py
index 4cd669c67..c8d902198 100644
--- a/hotel_channel_connector/models/hotel_room_type_restriction/common.py
+++ b/hotel_channel_connector/models/hotel_room_type_restriction/common.py
@@ -53,6 +53,7 @@ class ChannelHotelRoomTypeRestriction(models.Model):
importer = work.component(usage='hotel.room.type.restriction.importer')
return importer.import_restriction_plans()
+
class HotelRoomTypeRestriction(models.Model):
_inherit = 'hotel.room.type.restriction'
@@ -99,10 +100,15 @@ class HotelRoomTypeRestriction(models.Model):
@api.multi
def disconnect_channel_bind_ids(self):
- channel_bind_ids = self.mapped('channel_bind_ids')
- msg = _("This function is not yet implemented.")
- msg += _(" The restriction plan [%s] should be delete from the channel manager.") % channel_bind_ids.get_external_id
- raise UserError(msg)
+ # TODO: multichannel rooms is not implemented
+ self.channel_bind_ids.with_context({'connector_no_export': True}).unlink()
+
+ @api.multi
+ def write(self, vals):
+ if 'active' in vals and vals.get('active') is False:
+ self.channel_bind_ids.unlink()
+ return super().write(vals)
+
class BindingHotelRoomTypeListener(Component):
_name = 'binding.hotel.room.type.restriction.listener'
@@ -115,6 +121,7 @@ class BindingHotelRoomTypeListener(Component):
for binding in record.channel_bind_ids:
binding.update_plan_name()
+
class ChannelBindingHotelRoomTypeRestrictionListener(Component):
_name = 'channel.binding.hotel.room.type.restriction.listener'
_inherit = 'base.connector.listener'
diff --git a/hotel_channel_connector/views/inherited_hotel_room_type_restriction_views.xml b/hotel_channel_connector/views/inherited_hotel_room_type_restriction_views.xml
index 9cb595e56..e822a7328 100644
--- a/hotel_channel_connector/views/inherited_hotel_room_type_restriction_views.xml
+++ b/hotel_channel_connector/views/inherited_hotel_room_type_restriction_views.xml
@@ -5,11 +5,31 @@
hotel.room.type.restriction
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/hotel_channel_connector_wubook/models/hotel_room_type_restriction/exporter.py b/hotel_channel_connector_wubook/models/hotel_room_type_restriction/exporter.py
index 793a041f9..788e042fd 100644
--- a/hotel_channel_connector_wubook/models/hotel_room_type_restriction/exporter.py
+++ b/hotel_channel_connector_wubook/models/hotel_room_type_restriction/exporter.py
@@ -3,7 +3,8 @@
from odoo.addons.component.core import Component
from odoo.addons.hotel_channel_connector.components.core import ChannelConnectorError
-from odoo import api, fields
+from odoo import api, fields, _
+from odoo.exceptions import ValidationError
class HotelRoomTypeRestrictionExporter(Component):
@@ -23,6 +24,7 @@ class HotelRoomTypeRestrictionExporter(Component):
section='restriction',
internal_message=str(err),
channel_message=err.data['message'])
+ raise ValidationError(_(err.data['message']))
@api.model
def create_rplan(self, binding):
@@ -33,5 +35,6 @@ class HotelRoomTypeRestrictionExporter(Component):
section='restriction',
internal_message=str(err),
channel_message=err.data['message'])
+ raise ValidationError(_(err.data['message']))
else:
self.binder.bind(external_id, binding)