diff --git a/hotel_channel_connector/models/hotel_room_type/common.py b/hotel_channel_connector/models/hotel_room_type/common.py
index 8c5b6224a..43e50ab10 100644
--- a/hotel_channel_connector/models/hotel_room_type/common.py
+++ b/hotel_channel_connector/models/hotel_room_type/common.py
@@ -2,7 +2,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models, fields, _
-from odoo.exceptions import UserError
from odoo.exceptions import ValidationError
from odoo.addons import decimal_precision as dp
from odoo.addons.queue_job.job import job
@@ -26,7 +25,6 @@ class ChannelHotelRoomType(models.Model):
def _default_availability(self):
return max(min(self.default_quota, self.default_max_avail), 0)
-
odoo_id = fields.Many2one(comodel_name='hotel.room.type',
string='Room Type',
required=True,
@@ -172,10 +170,14 @@ class HotelRoomType(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 room type [%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):
diff --git a/hotel_channel_connector/views/inherited_hotel_room_type_views.xml b/hotel_channel_connector/views/inherited_hotel_room_type_views.xml
index 814227f2d..dc2538a26 100644
--- a/hotel_channel_connector/views/inherited_hotel_room_type_views.xml
+++ b/hotel_channel_connector/views/inherited_hotel_room_type_views.xml
@@ -5,20 +5,43 @@
hotel.room.type
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/hotel_channel_connector_wubook/models/hotel_room_type/exporter.py b/hotel_channel_connector_wubook/models/hotel_room_type/exporter.py
index 9131fb5d5..757a12380 100644
--- a/hotel_channel_connector_wubook/models/hotel_room_type/exporter.py
+++ b/hotel_channel_connector_wubook/models/hotel_room_type/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 AccessError, UserError, ValidationError
class HotelRoomTypeExporter(Component):
@@ -44,6 +45,7 @@ class HotelRoomTypeExporter(Component):
section='room',
internal_message=str(err),
channel_message=err.data['message'])
+ raise ValidationError(_(err.data['message']))
@api.model
def create_room(self, binding):
@@ -78,6 +80,7 @@ class HotelRoomTypeExporter(Component):
section='room',
internal_message=str(err),
channel_message=err.data['message'])
+ raise ValidationError(_(err.data['message']))
else:
binding.with_context({
'connector_no_export': True,