[FIX] WuBook issue with limit for min_price and max_price

This commit is contained in:
Pablo
2019-02-18 17:57:32 +01:00
parent 03874cfa6c
commit 4fd76ff42c
2 changed files with 15 additions and 3 deletions

View File

@@ -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"), {

View File

@@ -1,9 +1,10 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# 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)