diff --git a/hotel_channel_connector_wubook/components/backend_adapter.py b/hotel_channel_connector_wubook/components/backend_adapter.py index 9b9c615a2..7dbf0caa6 100644 --- a/hotel_channel_connector_wubook/components/backend_adapter.py +++ b/hotel_channel_connector_wubook/components/backend_adapter.py @@ -137,8 +137,8 @@ class WuBookAdapter(AbstractComponent): descriptions, boards, int(rtype), - # min_price, # Issue limit for min_price and max_price is they have to be higher than 5 - # max_price, + min_price, # Issue limit for min_price and max_price is they have to be higher than 5 + max_price, ) if rcode != 0: raise ChannelConnectorError(_("Can't create room in WuBook"), { diff --git a/hotel_channel_connector_wubook/models/hotel_room_type/common.py b/hotel_channel_connector_wubook/models/hotel_room_type/common.py index 061b93ab7..4f6bc406c 100644 --- a/hotel_channel_connector_wubook/models/hotel_room_type/common.py +++ b/hotel_channel_connector_wubook/models/hotel_room_type/common.py @@ -1,9 +1,10 @@ # Copyright 2018 Alexandre Díaz # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import api, models, fields, _ +from odoo.exceptions import ValidationError from odoo.addons.component.core import Component - class HotelRoomTypeAdapter(Component): _name = 'channel.hotel.room.type.adapter' _inherit = 'wubook.adapter' @@ -26,3 +27,14 @@ class HotelRoomTypeAdapter(Component): def delete_room(self, channel_room_id): return super(HotelRoomTypeAdapter, self).delete_room(channel_room_id) + + +class ChannelHotelRoomType(models.Model): + _inherit = 'hotel.room.type' + + @api.constrains('min_price', 'max_price') + def _check_min_max_price(self): + for record in self: + if record.min_price < 5 or record.max_price < 5: + msg = _("The channel manager limits the minimum value of min price and max price to 5.") + raise ValidationError(msg)