-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ Calendar colors
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hotel_channel_connector/__manifest__.py b/hotel_channel_connector/__manifest__.py
index 8bb150279..b478791b1 100644
--- a/hotel_channel_connector/__manifest__.py
+++ b/hotel_channel_connector/__manifest__.py
@@ -22,6 +22,7 @@
'wizard/wubook_import_plan_restrictions.xml',
'wizard/wubook_import_availability.xml',
'views/general.xml',
+ 'views/hotel_channel_connector_issue_views.xml',
'views/inherited_hotel_reservation_views.xml',
'views/inherited_hotel_room_type_views.xml',
'views/inherited_hotel_room_type_availability_views.xml',
@@ -29,14 +30,16 @@
'views/inherited_product_pricelist_views.xml',
'views/inherited_product_pricelist_item_views.xml',
'views/inherited_hotel_room_type_restriction_views.xml',
+ 'views/inherited_hotel_room_type_restriction_item_views.xml',
'views/inherited_res_partner_views.xml',
'views/channel_ota_info_views.xml',
- 'views/hotel_channel_connector_issue_views.xml',
'views/channel_hotel_reservation_views.xml',
'views/channel_hotel_room_type_views.xml',
'views/channel_hotel_room_type_availability_views.xml',
'views/channel_hotel_room_type_restriction_views.xml',
+ 'views/channel_hotel_room_type_restriction_item_views.xml',
'views/channel_product_pricelist_views.xml',
+ 'views/channel_product_pricelist_item_views.xml',
'views/channel_connector_backend_views.xml',
'data/menus.xml',
'data/sequences.xml',
diff --git a/hotel_channel_connector/components/backend_adapter.py b/hotel_channel_connector/components/backend_adapter.py
index e5b64afd7..07d2058ba 100644
--- a/hotel_channel_connector/components/backend_adapter.py
+++ b/hotel_channel_connector/components/backend_adapter.py
@@ -9,7 +9,6 @@ from odoo.tools import (
DEFAULT_SERVER_DATE_FORMAT,
DEFAULT_SERVER_DATETIME_FORMAT)
from odoo.addons.payment.models.payment_acquirer import _partner_split_name
-from odoo.addons.hotel import date_utils
from odoo.addons.hotel_channel_connector.components.core import ChannelConnectorError
from odoo import fields, _
_logger = logging.getLogger(__name__)
@@ -276,8 +275,8 @@ class WuBookAdapter(AbstractComponent):
rcode, results = self._server.fetch_rooms_values(
self._session_info[0],
self._session_info[1],
- date_utils.get_datetime(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
- date_utils.get_datetime(date_to).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(date_to).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
rooms)
if rcode != 0:
raise ChannelConnectorError("Can't fetch rooms values from WuBook", {
@@ -317,14 +316,14 @@ class WuBookAdapter(AbstractComponent):
'phone': phone,
'street': address,
'country': country_code,
- 'arrival_hour': date_utils.get_datetime(checkin).strftime("%H:%M"),
+ 'arrival_hour': fields.Datetime.from_string(checkin).strftime("%H:%M"),
'notes': notes
}
rcode, results = self._server.new_reservation(
self._session_info[0],
self._session_info[1],
- date_utils.get_datetime(checkin).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
- date_utils.get_datetime(checkout).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(checkin).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(checkout).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
{channel_room_id: [adults+children, 'nb']},
customer,
adults+children)
@@ -431,7 +430,7 @@ class WuBookAdapter(AbstractComponent):
self._session_info[0],
self._session_info[1],
channel_plan_id,
- date_utils.get_datetime(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
prices)
if rcode != 0:
raise ChannelConnectorError("Can't update pricing plan in wubook", {
@@ -442,7 +441,7 @@ class WuBookAdapter(AbstractComponent):
return results
def update_plan_periods(self, channel_plan_id, periods):
- rcode, results = self.SERVER.update_plan_periods(
+ rcode, results = self._server.update_plan_periods(
self._session_info[0],
self._session_info[1],
channel_plan_id,
@@ -455,7 +454,7 @@ class WuBookAdapter(AbstractComponent):
return results
def get_pricing_plans(self):
- rcode, results = self.SERVER.get_pricing_plans(
+ rcode, results = self._server.get_pricing_plans(
self._session_info[0],
self._session_info[1])
if rcode != 0:
@@ -469,8 +468,8 @@ class WuBookAdapter(AbstractComponent):
self._session_info[0],
self._session_info[1],
channel_plan_id,
- date_utils(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
- date_utils(date_to).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(date_to).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
rooms or [])
if rcode != 0:
raise ChannelConnectorError("Can't get pricing plans from wubook", {
@@ -496,8 +495,8 @@ class WuBookAdapter(AbstractComponent):
rcode, results = self._server.wired_rplan_get_rplan_values(
self._session_info[0],
self._session_info[1],
- date_utils(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
- date_utils(date_to).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(date_to).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
channel_restriction_plan_id)
if rcode != 0:
raise ChannelConnectorError("Can't fetch restriction plans from wubook", {
@@ -513,7 +512,7 @@ class WuBookAdapter(AbstractComponent):
self._session_info[0],
self._session_info[1],
channel_restriction_plan_id,
- date_utils(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
+ fields.Date.from_string(date_from).strftime(DEFAULT_WUBOOK_DATE_FORMAT),
values)
if rcode != 0:
raise ChannelConnectorError("Can't update plan restrictions on wubook", {
diff --git a/hotel_channel_connector/components/binder.py b/hotel_channel_connector/components/binder.py
index 3276998d5..3ed074208 100644
--- a/hotel_channel_connector/components/binder.py
+++ b/hotel_channel_connector/components/binder.py
@@ -11,6 +11,8 @@ class HotelConnectorModelBinder(Component):
'channel.hotel.room.type',
'channel.hotel.room.type.availability',
'channel.hotel.room.type.restriction',
+ 'channel.hotel.room.type.restriction.item',
'channel.product.pricelist',
+ 'channel.product.pricelist.item',
'channel.ota.info',
]
diff --git a/hotel_channel_connector/components/core.py b/hotel_channel_connector/components/core.py
index 951c40996..0400e7fba 100644
--- a/hotel_channel_connector/components/core.py
+++ b/hotel_channel_connector/components/core.py
@@ -9,18 +9,6 @@ class BaseHotelChannelConnectorComponent(AbstractComponent):
_inherit = 'base.connector'
_collection = 'channel.backend'
- @api.model
- def create_issue(self, section, message, channel_message, channel_object_id=False,
- dfrom=False, dto=False):
- self.env['hotel.channel.connector.issue'].sudo().create({
- 'section': section,
- 'internal_message': message,
- 'channel_object_id': channel_object_id,
- 'channel_message': channel_message,
- 'date_start': dfrom,
- 'date_end': dto,
- })
-
class ChannelConnectorError(Exception):
def __init__(self, message, data):
super().__init__(message)
diff --git a/hotel_channel_connector/components/exporter.py b/hotel_channel_connector/components/exporter.py
index fb42e8e61..bc1545ede 100644
--- a/hotel_channel_connector/components/exporter.py
+++ b/hotel_channel_connector/components/exporter.py
@@ -12,7 +12,7 @@ from odoo.tools import (
DEFAULT_SERVER_DATETIME_FORMAT)
from .backend_adapter import DEFAULT_WUBOOK_DATE_FORMAT
from odoo.addons.hotel import date_utils
-from odoo import api
+from odoo import api, fields
_logger = logging.getLogger(__name__)
class HotelChannelConnectorExporter(AbstractComponent):
@@ -25,42 +25,6 @@ class HotelChannelConnectorExporter(AbstractComponent):
return self.push_availability() and self.push_priceplans() and \
self.push_restrictions()
- @api.model
- def push_availability(self):
- room_type_avail_ids = self.env['hotel.room.type.availability'].search([
- ('wpushed', '=', False),
- ('date', '>=', date_utils.now(hours=False).strftime(
- DEFAULT_SERVER_DATE_FORMAT))
- ])
-
- room_types = room_type_avail_ids.mapped('room_type_id')
- avails = []
- for room_type in room_types:
- room_type_avails = room_type_avail_ids.filtered(
- lambda x: x.room_type_id.id == room_type.id)
- days = []
- for room_type_avail in room_type_avails:
- room_type_avail.with_context({
- 'wubook_action': False}).write({'wpushed': True})
- wavail = room_type_avail.avail
- if wavail > room_type_avail.wmax_avail:
- wavail = room_type_avail.wmax_avail
- date_dt = date_utils.get_datetime(
- room_type_avail.date,
- dtformat=DEFAULT_SERVER_DATE_FORMAT)
- days.append({
- 'date': date_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
- 'avail': wavail,
- 'no_ota': room_type_avail.no_ota and 1 or 0,
- # 'booked': room_type_avail.booked and 1 or 0,
- })
- avails.append({'id': room_type.wrid, 'days': days})
- _logger.info("UPDATING AVAILABILITY IN WUBOOK...")
- _logger.info(avails)
- if any(avails):
- self.backend_adapter.update_availability(avails)
- return True
-
@api.model
def push_priceplans(self):
unpushed = self.env['product.pricelist.item'].search([
diff --git a/hotel_channel_connector/components/importer.py b/hotel_channel_connector/components/importer.py
index dc94680dd..093a7b7f2 100644
--- a/hotel_channel_connector/components/importer.py
+++ b/hotel_channel_connector/components/importer.py
@@ -238,9 +238,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
# the same transaction an cancellation)
if crcode in failed_reservations:
self.create_issue(
- 'reservation',
- "Can't process a reservation that previusly failed!",
- '', channel_object_id=book['reservation_code'])
+ section='reservation',
+ internal_emssage="Can't process a reservation that previusly failed!",
+ channel_object_id=book['reservation_code'])
continue
# Get dates for the reservation (GMT->UTC)
@@ -342,10 +342,10 @@ class HotelChannelConnectorImporter(AbstractComponent):
], limit=1)
if not room_type:
self.create_issue(
- 'reservation',
- "Can't found any room type associated to '%s' \
- in this hotel" % book['rooms'],
- '', channel_object_id=book['reservation_code'])
+ section='reservation',
+ internal_message="Can't found any room type associated to '%s' \
+ in this hotel" % book['rooms'],
+ channel_object_id=book['reservation_code'])
failed_reservations.append(crcode)
continue
@@ -376,9 +376,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
)
if vals['price_unit'] != book['amount']:
self.create_issue(
- 'reservation',
- "Invalid reservation total price! %.2f != %.2f" % (vals['price_unit'], book['amount']),
- '', channel_object_id=book['reservation_code'])
+ section='reservation',
+ internal_message="Invalid reservation total price! %.2f != %.2f" % (vals['price_unit'], book['amount']),
+ channel_object_id=book['reservation_code'])
free_rooms = room_type.odoo_id.check_availability_room(
checkin_str,
@@ -439,9 +439,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
})
reservations.append((0, False, vals))
self.create_issue(
- 'reservation',
- "Reservation imported with overbooking state",
- '', channel_object_id=rcode)
+ section='reservation',
+ internal_message="Reservation imported with overbooking state",
+ channel_object_id=rcode)
dates_checkin = [False, False]
dates_checkout = [False, False]
split_booking = False
@@ -458,9 +458,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
if split_booking:
self.create_issue(
- 'reservation',
- "Reservation Splitted",
- '', channel_object_id=rcode)
+ section='reservation',
+ internal_message="Reservation Splitted",
+ channel_object_id=rcode)
# Create Folio
if not any(failed_reservations) and any(reservations):
@@ -498,9 +498,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
processed_rids.append(rcode)
except ChannelConnectorError as err:
self.create_issue(
- 'reservation',
- err.data['message'],
- '', channel_object_id=rcode)
+ section='reservation',
+ internal_message=err.data['message'],
+ channel_object_id=rcode)
failed_reservations.append(crcode)
return (processed_rids, any(failed_reservations),
checkin_utc_dt, checkout_utc_dt)
@@ -692,9 +692,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
count = self._generate_pricelists(results)
except ChannelConnectorError as err:
self.create_issue(
- 'plan',
- _("Can't get pricing plans from wubook"),
- err.data['message'])
+ section='plan',
+ internal_message=_("Can't get pricing plans from wubook"),
+ channel_message=err.data['message'])
return 0
return count
@@ -709,9 +709,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
self._generate_pricelist_items(channel_plan_id, date_from, date_to, results)
except ChannelConnectorError as err:
self.create_issue(
- 'plan',
- _("Can't fetch plan prices from wubook"),
- err.data['message'])
+ section='plan',
+ internal_message=_("Can't fetch plan prices from wubook"),
+ channel_message=err.data['message'])
return False
return True
@@ -732,9 +732,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
self._generate_pricelist_items(channel_plan_id, date_from, date_to, results)
except ChannelConnectorError as err:
self.create_issue(
- 'plan',
- "Can't fetch all plan prices from wubook!",
- err.data['message'],
+ section='plan',
+ internal_message="Can't fetch all plan prices from wubook!",
+ channel_message=err.data['message'],
channel_object_id=channel_plan_id, dfrom=date_from, dto=date_to)
return False
return no_errors
@@ -746,9 +746,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
count = self._generate_restrictions(results)
except ChannelConnectorError as err:
self.create_issue(
- 'rplan',
- _("Can't fetch restriction plans from wubook"),
- err.data['message'])
+ section='rplan',
+ internal_message=_("Can't fetch restriction plans from wubook"),
+ channel_message=err.data['message'])
return 0
return count
@@ -763,9 +763,9 @@ class HotelChannelConnectorImporter(AbstractComponent):
self._generate_restriction_items(results)
except ChannelConnectorError as err:
self.create_issue(
- 'rplan',
- _("Can't fetch plan restrictions from wubook"),
- err.data['message'],
+ section='rplan',
+ internal_message=_("Can't fetch plan restrictions from wubook"),
+ channel_message=err.data['message'],
channel_object_id=channel_restriction_plan_id,
dfrom=date_from, dto=date_to)
return False
diff --git a/hotel_channel_connector/data/menus.xml b/hotel_channel_connector/data/menus.xml
index 06b13e837..3b6264619 100644
--- a/hotel_channel_connector/data/menus.xml
+++ b/hotel_channel_connector/data/menus.xml
@@ -13,12 +13,6 @@
parent="menu_channel_connector_root"
action="action_channel_backend"/>
-
-
diff --git a/hotel_channel_connector/views/channel_hotel_reservation_views.xml b/hotel_channel_connector/views/channel_hotel_reservation_views.xml
index f75d53daa..bf6057427 100644
--- a/hotel_channel_connector/views/channel_hotel_reservation_views.xml
+++ b/hotel_channel_connector/views/channel_hotel_reservation_views.xml
@@ -7,7 +7,7 @@