diff --git a/hotel_channel_connector/models/hotel_room_type/common.py b/hotel_channel_connector/models/hotel_room_type/common.py
index 8c500d877..50e76c605 100644
--- a/hotel_channel_connector/models/hotel_room_type/common.py
+++ b/hotel_channel_connector/models/hotel_room_type/common.py
@@ -3,6 +3,7 @@
from odoo import api, models, fields, _
from odoo.exceptions import ValidationError
+from odoo.addons import decimal_precision as dp
from odoo.addons.queue_job.job import job
from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if
@@ -18,8 +19,12 @@ class ChannelHotelRoomType(models.Model):
string='Room Type',
required=True,
ondelete='cascade')
- channel_short_code = fields.Char("Channel Short Code", readonly=True, old_name='wscode')
+ channel_short_code = fields.Char("Channel Short Code", old_name='wscode')
ota_capacity = fields.Integer("OTA's Capacity", default=1, old_name='wcapacity')
+ min_price = fields.Float('Min. Price', default=5.0, digits=dp.get_precision('Product Price'),
+ help="Setup the min price to prevent incidents while editing your prices.")
+ max_price = fields.Float('Max. Price', default=200.0, digits=dp.get_precision('Product Price'),
+ help="Setup the max price to prevent incidents while editing your prices.")
@api.onchange('room_ids')
def _get_capacity(self):
diff --git a/hotel_channel_connector/views/channel_hotel_room_type_views.xml b/hotel_channel_connector/views/channel_hotel_room_type_views.xml
index 8fdd1cffb..82acb2a32 100644
--- a/hotel_channel_connector/views/channel_hotel_room_type_views.xml
+++ b/hotel_channel_connector/views/channel_hotel_room_type_views.xml
@@ -15,6 +15,10 @@
+
+
+
+
diff --git a/hotel_channel_connector_wubook/components/backend_adapter.py b/hotel_channel_connector_wubook/components/backend_adapter.py
index 4ff5bba63..f822fb2d9 100644
--- a/hotel_channel_connector_wubook/components/backend_adapter.py
+++ b/hotel_channel_connector_wubook/components/backend_adapter.py
@@ -122,6 +122,8 @@ class WuBookAdapter(AbstractComponent):
# === ROOMS
def create_room(self, shortcode, name, capacity, price, availability, defboard, rtype):
+ import wdb;
+ wdb.set_trace()
rcode, results = self._server.new_room(
self._session_info[0],
self._session_info[1],
@@ -140,7 +142,8 @@ class WuBookAdapter(AbstractComponent):
})
return results
- def modify_room(self, channel_room_id, name, capacity, price, availability, scode, defboard, rtype):
+ def modify_room(self, channel_room_id, name, capacity, price, availability, scode, defboard,
+ names, descriptions, boards, min_price, max_price, rtype):
rcode, results = self._server.mod_room(
self._session_info[0],
self._session_info[1],
@@ -151,7 +154,13 @@ class WuBookAdapter(AbstractComponent):
availability,
scode,
defboard,
- rtype
+ names,
+ descriptions,
+ boards,
+ min_price,
+ max_price,
+ int(rtype),
+ False,
)
if rcode != 0:
raise ChannelConnectorError(_("Can't modify 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 85813bb05..8540d6eb6 100644
--- a/hotel_channel_connector_wubook/models/hotel_room_type/common.py
+++ b/hotel_channel_connector_wubook/models/hotel_room_type/common.py
@@ -16,9 +16,11 @@ class HotelRoomTypeAdapter(Component):
def fetch_rooms(self):
return super(HotelRoomTypeAdapter, self).fetch_rooms()
- def modify_room(self, channel_room_id, name, capacity, price, availability, scode, defboard, rtype):
+ def modify_room(self, channel_room_id, name, capacity, price, availability, scode, defboard,
+ names, descriptions, boards, min_price, max_price, rtype):
return super(HotelRoomTypeAdapter, self).modify_room(
- channel_room_id, name, capacity, price, availability, scode, defboard, rtype)
+ channel_room_id, name, capacity, price, availability, scode, defboard,
+ names, descriptions, boards, min_price, max_price, rtype)
def delete_room(self, channel_room_id):
return super(HotelRoomTypeAdapter, self).delete_room(channel_room_id)
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 325e1406e..12328a36a 100644
--- a/hotel_channel_connector_wubook/models/hotel_room_type/exporter.py
+++ b/hotel_channel_connector_wubook/models/hotel_room_type/exporter.py
@@ -15,6 +15,14 @@ class HotelRoomTypeExporter(Component):
binding.with_context({
'connector_no_export': True,
}).write({'sync_date': fields.Datetime.now()})
+ # TODO: do not write if backend_adapter.modify_room through an error
+ boards = {}
+ for board in binding.board_service_room_type_ids:
+ boards.update(
+ {board.channel_service: {
+ 'dtype': 2 if board.price_type == 'fixed' else 1,
+ 'value': board.amount}}
+ )
return self.backend_adapter.modify_room(
binding.external_id,
binding.name,
@@ -23,7 +31,13 @@ class HotelRoomTypeExporter(Component):
binding.total_rooms_count,
binding.channel_short_code,
'nb',
- binding.class_id and binding.class_id.code_class or False)
+ {},
+ {},
+ boards,
+ binding.min_price,
+ binding.max_price,
+ binding.class_id and binding.class_id.code_class or False,
+ )
except ChannelConnectorError as err:
self.create_issue(
section='room',