diff --git a/hotel_channel_connector/models/product_pricelist/common.py b/hotel_channel_connector/models/product_pricelist/common.py
index f2257a721..995672a20 100644
--- a/hotel_channel_connector/models/product_pricelist/common.py
+++ b/hotel_channel_connector/models/product_pricelist/common.py
@@ -82,7 +82,6 @@ class ProductPricelist(models.Model):
inverse_name='odoo_id',
string='Hotel Channel Connector Bindings')
-
pricelist_type = fields.Selection(selection_add=[
('virtual', 'Virtual Plan'),
])
@@ -104,7 +103,6 @@ class ProductPricelist(models.Model):
for item in record.item_ids):
record.is_virtual_plan = False
-
@api.multi
@api.depends('name')
def name_get(self):
@@ -144,10 +142,14 @@ class ProductPricelist(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 pricelist [%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 BindingProductPricelistListener(Component):
diff --git a/hotel_channel_connector/views/inherited_product_pricelist_views.xml b/hotel_channel_connector/views/inherited_product_pricelist_views.xml
index dec33b25a..09f8b7309 100644
--- a/hotel_channel_connector/views/inherited_product_pricelist_views.xml
+++ b/hotel_channel_connector/views/inherited_product_pricelist_views.xml
@@ -5,11 +5,31 @@
product.pricelist
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/hotel_channel_connector_wubook/models/product_pricelist/deleter.py b/hotel_channel_connector_wubook/models/product_pricelist/deleter.py
index 6fd73acaa..8874d2ba2 100644
--- a/hotel_channel_connector_wubook/models/product_pricelist/deleter.py
+++ b/hotel_channel_connector_wubook/models/product_pricelist/deleter.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
+from odoo import api, _
+from odoo.exceptions import ValidationError
class ProductPricelistDeleter(Component):
@@ -18,3 +19,4 @@ class ProductPricelistDeleter(Component):
section='pricelist',
internal_message=str(err),
channel_message=err.data['message'])
+ raise ValidationError(_(err.data['message']) + ". " + _(str(err)))
diff --git a/hotel_channel_connector_wubook/models/product_pricelist/exporter.py b/hotel_channel_connector_wubook/models/product_pricelist/exporter.py
index a073f2dc0..e1ab247a0 100644
--- a/hotel_channel_connector_wubook/models/product_pricelist/exporter.py
+++ b/hotel_channel_connector_wubook/models/product_pricelist/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 ProductPricelistExporter(Component):
@@ -23,6 +24,7 @@ class ProductPricelistExporter(Component):
section='pricelist',
internal_message=str(err),
channel_message=err.data['message'])
+ raise ValidationError(_(err.data['message']))
@api.model
def create_plan(self, binding):
@@ -33,6 +35,7 @@ class ProductPricelistExporter(Component):
section='pricelist',
internal_message=str(err),
channel_message=err.data['message'])
+ raise ValidationError(_(err.data['message']))
else:
binding.external_id = external_id
self.binder.bind(external_id, binding)
@@ -67,6 +70,7 @@ class ProductPricelistExporter(Component):
section='pricelist',
internal_message=str(err),
channel_message=err.data['message'])
+ raise ValidationError(_(err.data['message']))
else:
binding.external_id = external_id
self.binder.bind(external_id, binding)
@@ -102,3 +106,4 @@ class ProductPricelistExporter(Component):
section='pricelist',
internal_message=str(err),
channel_message=err.data['message'])
+ raise ValidationError(_(err.data['message']))