[WIP][MIG][11.0] Odoo Connector

This commit is contained in:
QS5ELkMu
2018-08-20 04:06:21 +02:00
parent c380d37aa5
commit 74ceb01ec0
49 changed files with 458 additions and 407 deletions

View File

@@ -1,6 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
from . import controllers
from . import models
from . import wizard

View File

@@ -23,9 +23,8 @@
'wizard/wubook_import_plan_restrictions.xml',
'wizard/wubook_import_availability.xml',
'views/general.xml',
'views/res_config_views.xml',
'views/inherited_hotel_reservation_views.xml',
'views/inherited_hotel_virtual_room_views.xml',
'views/inherited_hotel_room_type_views.xml',
'views/inherited_hotel_virtual_room_availability_views.xml',
'views/inherited_hotel_folio_views.xml',
'views/inherited_product_pricelist_views.xml',
@@ -35,6 +34,11 @@
'views/inherited_res_partner_views.xml',
'views/wubook_channel_info_views.xml',
'views/wubook_issue_views.xml',
'views/channel_hotel_reservation_views.xml',
'views/channel_hotel_room_type_views.xml',
'views/channel_hotel_virtual_room_availability_views.xml',
'views/channel_hotel_virtual_room_restriction_views.xml',
'views/channel_product_pricelist_views.xml',
'data/menus.xml',
'data/sequences.xml',
'security/ir.model.access.csv',

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import backend_adapter
from . import binder
from . import core

View File

@@ -1,3 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.addons.component.core import AbstractComponent
from odoo.addons.queue_job.exception import RetryableJobError
from odoo.tools import (

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.addons.component.core import Component
class HotelConnectorModelBinder(Component):

View File

@@ -1,3 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.addons.component.core import AbstractComponent
from odoo import api

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo.addons.component.core import AbstractComponent
from odoo.tools import (

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo.addons.component.core import AbstractComponent
from odoo.tools import (

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from openerp import http, _
from openerp.http import request

View File

@@ -1,7 +1,10 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import channel_backend
from . import channel_binding
from . import res_config
from . import hotel_virtual_room
from . import hotel_room_type
from . import product_pricelist
from . import inherited_product_pricelist_item
from . import hotel_virtual_room_restriction
@@ -10,5 +13,5 @@ from . import hotel_virtual_room_availability
from . import hotel_reservation
from . import inherited_hotel_folio
from . import inherited_res_partner
from . import wubook_channel_info
from . import hotel_channel_connector_ota_info
from . import hotel_channel_connector_issue

View File

@@ -1,3 +1,4 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import common

View File

@@ -1,11 +1,22 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from contextlib import contextmanager
from odoo import models, api, fields
from ...components.backend_adapter import WuBookLogin, WuBookAdapter
class ChannelBackend(models.Model):
_name = 'channel.backend'
_description = 'Hotel Channel Backend'
_inherit = 'connector.backend'
username = fields.Char('Channel Service Username')
passwd = fields.Char('Channel Service Password')
lcode = fields.Char('Channel Service lcode')
server = fields.Char('Channel Service Server',
default='https://wired.wubook.net/xrws/')
pkey = fields.Char('Channel Service PKey')
@contextmanager
@api.multi
def work_on(self, model_name, **kwargs):
@@ -13,23 +24,12 @@ class ChannelBackend(models.Model):
lang = self.default_lang_id
if lang.code != self.env.context.get('lang'):
self = self.with_context(lang=lang.code)
user = self.env['ir.default'].sudo().get(
'res.config.settings', 'hotel_connector_user')
passwd = self.env['ir.default'].sudo().get(
'res.config.settings', 'hotel_connector_passwd')
lcode = self.env['ir.default'].sudo().get(
'res.config.settings', 'hotel_connector_lcode')
pkey = self.env['ir.default'].sudo().get(
'res.config.settings', 'hotel_connector_pkey')
server_addr = self.env['ir.default'].sudo().get(
'res.config.settings', 'hotel_connector_server')
wubook_login = WuBookLogin(
server_addr,
user,
passwd,
lcode,
pkey
)
self.server,
self.username,
self.passwd,
self.lcode,
self.pkey)
with WuBookAdapter(wubook_login) as channel_api:
_super = super(ChannelBackend, self)
# from the components we'll be able to do: self.work.magento_api

View File

@@ -1,3 +1,4 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import common

View File

@@ -1,8 +1,7 @@
# 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.addons.queue_job.job import job, related_action
from odoo import models, fields
class ChannelBinding(models.AbstractModel):

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
from openerp.exceptions import ValidationError

View File

@@ -1,7 +1,8 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
from openerp import models, fields, api
from odoo.addons.queue_job.job import job
class HotelChannelConnectorOTAInfo(models.Model):
_name = 'hote.channel.connector.ota.info'

View File

@@ -1,3 +1,4 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import common

View File

@@ -3,6 +3,15 @@
from odoo import api, models, fields
from odoo.addons.queue_job.job import job, related_action
from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if
from odoo.addons.hotel_channel_connector.components.backend_adapter import (
WUBOOK_STATUS_CONFIRMED,
WUBOOK_STATUS_WAITING,
WUBOOK_STATUS_REFUSED,
WUBOOK_STATUS_ACCEPTED,
WUBOOK_STATUS_CANCELLED,
WUBOOK_STATUS_CANCELLED_PENALTY)
class ChannelHotelReservation(models.Model):
_name = 'channel.hotel.reservation'
@@ -10,11 +19,6 @@ class ChannelHotelReservation(models.Model):
_inherits = {'hotel.reservation': 'odoo_id'}
_description = 'Channel Hotel Reservation'
@api.depends('channel_reservation_id', 'ota_id')
def _is_from_ota(self):
for record in self:
record.is_from_ota = (record.channel_reservation_id and record.ota_id)
odoo_id = fields.Many2one(comodel_names='hotel.reservation',
string='Reservation',
required=True,
@@ -27,25 +31,18 @@ class ChannelHotelReservation(models.Model):
ota_reservation_id = fields.Char("Channel OTA Reservation Code",
readonly=True,
old_name='wchannel_reservation_code')
is_from_ota = fields.Boolean('Is From OTA',
compute=_is_from_ota, store=False,
readonly=True,
old_name='wis_from_channel')
to_read = fields.Boolean('To Read', default=False)
able_to_modify_channel = fields.Boolean(compute=set_access_for_wubook_fields,
string='Is user able to modify wubook fields?',
old_name='able_to_modify_wubook')
channel_raw_data = fields.Text(readonly=True, old_name='wbook_json')
wstatus = fields.Selection([
('0', 'No WuBook'),
('0', 'No Channel'),
(str(WUBOOK_STATUS_CONFIRMED), 'Confirmed'),
(str(WUBOOK_STATUS_WAITING), 'Waiting'),
(str(WUBOOK_STATUS_REFUSED), 'Refused'),
(str(WUBOOK_STATUS_ACCEPTED), 'Accepted'),
(str(WUBOOK_STATUS_CANCELLED), 'Cancelled'),
(str(WUBOOK_STATUS_CANCELLED_PENALTY), 'Cancelled with penalty')],
string='WuBook Status', default='0',
string='WuBook Status',
default='0',
readonly=True)
wstatus_reason = fields.Char("WuBook Status Reason", readonly=True)
customer_notes = fields.Text(related='folio_id.customer_notes',
@@ -68,23 +65,39 @@ class ChannelHotelReservation(models.Model):
def cancel_reservation(self):
self.ensure_one()
if self._context.get('channel_action', True):
user = self.env['res.user'].browse(self.env.uid)
with self.backend_id.work_on(self._name) as work:
adapter = work.component(usage='backend.adapter')
wres = adapter.cancel_reservation(
self.channel_reservation_id,
_('Cancelled by %s') % partner_id.name)
_('Cancelled by %s') % user.partner_id.name)
if not wres:
raise ValidationError(_("Can't cancel reservation on WuBook"))
class HotelReservation(models.Model):
_inherit = 'hotel.reservation'
@api.depends('channel_bind_ids.channel_reservation_id', 'channel_bind_ids.ota_id')
def _is_from_ota(self):
for record in self:
record.is_from_ota = (record.channel_bind_ids.channel_reservation_id and \
record.channel_bind_ids.ota_id)
@api.multi
def set_access_for_wubook_fields(self):
def _set_access_for_wubook_fields(self):
for rec in self:
user = self.env['res.users'].browse(self.env.uid)
rec.able_to_modify_channel = user.has_group('base.group_system')
is_from_ota = fields.Boolean('Is From OTA',
compute=_is_from_ota, store=False,
readonly=True,
old_name='wis_from_channel')
able_to_modify_channel = fields.Boolean(compute=_set_access_for_wubook_fields,
string='Is user able to modify wubook fields?',
old_name='able_to_modify_wubook')
to_read = fields.Boolean('To Read', default=False)
@api.depends('channel_type', 'ota_id')
def _get_origin_sale(self):
for record in self:
@@ -211,30 +224,27 @@ class HotelReservation(models.Model):
raise ValidationError(_("Can't confirm OTA's cancelled reservations"))
return super(HotelReservation, self).confirm()
@api.multi
def generate_copy_values(self, checkin=False, checkout=False):
self.ensure_one()
res = super().generate_copy_values(checkin=checkin, checkout=checkout)
res.update({
'channel_reservation_id': self.channel_reservation_id,
'ota_id': self.ota_id and self.ota_id.id or False,
'ota_reservation_code': self.ota_reservation_code,
'is_from_ota': self.is_from_ota,
'to_read': self.to_read,
'wstatus': self.wstatus,
'wstatus_reason': self.wstatus_reason,
'customer_notes': self.customer_notes,
})
return res
# @api.multi
# def generate_copy_values(self, checkin=False, checkout=False):
# self.ensure_one()
# res = super().generate_copy_values(checkin=checkin, checkout=checkout)
# res.update({
# 'channel_reservation_id': self.channel_reservation_id,
# 'ota_id': self.ota_id and self.ota_id.id or False,
# 'ota_reservation_code': self.ota_reservation_code,
# 'is_from_ota': self.is_from_ota,
# 'to_read': self.to_read,
# 'wstatus': self.wstatus,
# 'wstatus_reason': self.wstatus_reason,
# 'customer_notes': self.customer_notes,
# })
# return res
@api.multi
def action_reservation_checkout(self):
for record in self:
if record.state == 'cancelled':
return
else:
return super(HotelReservation, record).\
action_reservation_checkout()
if record.state != 'cancelled':
return super(HotelReservation, record).action_reservation_checkout()
@api.model
def _hcalendar_reservation_data(self, reservations):

View File

@@ -1,3 +1,4 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import common

View File

@@ -3,12 +3,14 @@
from odoo import api, models, fields
from odoo.addons.queue_job.job import job, related_action
from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if
class ChannelHotelVirtualRoom(models.Model):
_name = 'channel.hotel.virtual.room'
class ChannelHotelRoomType(models.Model):
_name = 'channel.hotel.room.type'
_inherit = 'channel.binding'
_inherits = {'hotel.virtual.room': 'odoo_id'}
_description = 'Channel Hotel Virtual Room'
_inherits = {'hotel.room.type': 'odoo_id'}
_description = 'Channel Hotel Room'
@api.depends('ota_capacity')
@api.onchange('room_ids', 'room_type_ids')
@@ -16,8 +18,8 @@ class ChannelHotelVirtualRoom(models.Model):
for rec in self:
rec.ota_capacity = rec.get_capacity()
odoo_id = fields.Many2one(comodel_names='hotel.virtual.room',
string='Reservation',
odoo_id = fields.Many2one(comodel_names='hotel.room.type',
string='Room Type',
required=True,
ondelete='cascade')
channel_room_id = fields.Char("Channel Room ID", readonly=True, old_name='wrid')
@@ -102,11 +104,11 @@ class ChannelHotelVirtualRoom(models.Model):
importer = work.component(usage='channel.importer')
return importer.import_rooms()
class HotelVirtualRoom(models.Model):
_inherit = 'hotel.virtual.room'
class HotelRoomType(models.Model):
_inherit = 'hotel.room.type'
channel_bind_ids = fields.One2many(
comodel_name='channel.hotel.virtual.room',
comodel_name='channel.hotel.room.type',
inverse_name='odoo_id',
string='Hotel Channel Connector Bindings')
@@ -124,10 +126,10 @@ class HotelVirtualRoom(models.Model):
], limit=1)
return restriction
class ChannelBindingVirtualRoomListener(Component):
_name = 'channel.binding.virtual.room.listener'
class ChannelBindingRoomTypeListener(Component):
_name = 'channel.binding.room.type.listener'
_inherit = 'base.connector.listener'
_apply_on = ['channel.virtual.room']
_apply_on = ['channel.room.type']
@skip_if(lambda self, record, **kwargs: self.no_connector_export(record))
def on_record_write(self, record, fields=None):

View File

@@ -1,3 +1,4 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import common

View File

@@ -3,6 +3,8 @@
from odoo import api, models, fields
from odoo.addons.queue_job.job import job, related_action
from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if
class ChannelHotelVirtualRoomAvailability(models.Model):
_name = 'channel.hotel.virtual.room.availability'

View File

@@ -1,3 +1,4 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import common

View File

@@ -3,6 +3,8 @@
from odoo import api, models, fields
from odoo.addons.queue_job.job import job, related_action
from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if
class ChannelHotelVirtualRoomRestriction(models.Model):
_name = 'channel.hotel.virtual.room.restriction'

View File

@@ -1,6 +1,8 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
from odoo.addons.queue_job.job import job
class HotelFolio(models.Model):

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
from openerp.exceptions import ValidationError

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api

View File

@@ -1,3 +1,4 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import common

View File

@@ -3,6 +3,8 @@
from odoo import api, models, fields
from odoo.addons.queue_job.job import job, related_action
from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if
class ChannelProductPricelist(models.Model):
_name = 'channel.product.pricelist'

View File

@@ -1,5 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import os
import binascii
import logging
@@ -10,49 +11,30 @@ from odoo.addons.hotel import date_utils
_logger = logging.getLogger(__name__)
class WubookConfiguration(models.TransientModel):
_name = 'wubook.config.settings'
class HotelChannelConnectorConfiguration(models.TransientModel):
_inherit = 'res.config.settings'
wubook_user = fields.Char('WuBook User')
wubook_passwd = fields.Char('WuBook Password')
wubook_lcode = fields.Char('WuBook lcode')
wubook_server = fields.Char('WuBook Server',
default='https://wired.wubook.net/xrws/')
wubook_pkey = fields.Char('WuBook PKey')
wubook_push_security_token = fields.Char('WuBook Push Notification \
Security Token')
channel_push_security_token = fields.Char('WuBook Push Notification Security Token')
@api.multi
def set_wubook_user(self):
return self.env['ir.default'].sudo().set(
'wubook.config.settings', 'wubook_user', self.wubook_user)
def set_values(self):
super(HotelChannelConnectorConfiguration, self).set_values()
@api.multi
def set_wubook_passwd(self):
return self.env['ir.default'].sudo().set(
'wubook.config.settings', 'wubook_passwd', self.wubook_passwd)
self.env['ir.default'].sudo().set(
'res.config.settings', 'channel_push_security_token',
self.channel_push_security_token)
@api.multi
def set_wubook_lcode(self):
return self.env['ir.default'].sudo().set(
'wubook.config.settings', 'wubook_lcode', self.wubook_lcode)
@api.model
def get_values(self):
res = super(HotelChannelConnectorConfiguration, self).get_values()
@api.multi
def set_wubook_server(self):
return self.env['ir.default'].sudo().set(
'wubook.config.settings', 'wubook_server', self.wubook_server)
@api.multi
def set_wubook_pkey(self):
return self.env['ir.default'].sudo().set(
'wubook.config.settings', 'wubook_pkey', self.wubook_pkey)
@api.multi
def set_wubook_push_security_token(self):
return self.env['ir.default'].sudo().set(
'wubook.config.settings',
'wubook_push_security_token', self.wubook_push_security_token)
# ONLY FOR v11. DO NOT FORWARD-PORT
channel_push_security_token = self.env['ir.default'].sudo().get(
'res.config.settings', 'channel_push_security_token')
res.update(
channel_push_security_token=channel_push_security_token,
)
return res
# Dangerus method: Usefull for cloned instances with new wubook account
@api.multi

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_channel_hotel_reservation_form" model="ir.ui.view">
<field name="name">channel.hotel.reservation.form</field>
<field name="model">channel.hotel.reservation</field>
<field name="arch" type="xml">
<form string="Hotel Channel Reservation">
<group>
<field name="channel_reservation_id" />
<field name="ota_reservation_code" />
<field name="wstatus" />
<field name="wstatus_reason" />
<field name="to_read" />
</group>
</form>
</field>
</record>
<record id="view_channel_hotel_reservation_tree" model="ir.ui.view">
<field name="name">channel.hotel.reservation.tree</field>
<field name="model">channel.hotel.reservation</field>
<field name="arch" type="xml">
<tree string="Hotel Channel Reservation">
<field name="backend_id"/>
</tree>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_channel_hotel_virtual_room_form" model="ir.ui.view">
<field name="name">channel.hotel.virtual.room.form</field>
<field name="model">channel.hotel.virtual.room</field>
<field name="arch" type="xml">
<form string="Hotel Channel Virtual Room">
<group>
<field name="channel_room_id" />
<field name="channel_short_code" />
<field name="ota_capacity" />
</group>
</form>
</field>
</record>
<record id="view_channel_hotel_virtual_room_tree" model="ir.ui.view">
<field name="name">channel.hotel.virtual.room.tree</field>
<field name="model">channel.hotel.virtual.room</field>
<field name="arch" type="xml">
<tree string="Hotel Channel Virtual Room">
<field name="backend_id"/>
</tree>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_channel_hotel_virtual_room_availability_form" model="ir.ui.view">
<field name="name">channel.hotel.virtual.room.availability.form</field>
<field name="model">channel.hotel.virtual.room.availability</field>
<field name="arch" type="xml">
<form string="Hotel Channel Room Availability">
<group>
<field name="channel_max_avail" />
<field name="channel_pushed" />
</group>
</form>
</field>
</record>
<record id="view_channel_hotel_virtual_room_availability_tree" model="ir.ui.view">
<field name="name">channel.hotel.virtual.room.availability.tree</field>
<field name="model">channel.hotel.virtual.availability.room</field>
<field name="arch" type="xml">
<tree string="Hotel Channel Room Availability">
<field name="backend_id"/>
</tree>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_channel_hotel_virtual_room_restriction_form" model="ir.ui.view">
<field name="name">channel.hotel.virtual.room.restriction.form</field>
<field name="model">channel.hotel.virtual.room.restriction</field>
<field name="arch" type="xml">
<form string="Hotel Channel Room Restriction">
<group>
<field name="channel_plan_id" />
<field name="is_daily_plan" />
</group>
</form>
</field>
</record>
<record id="view_channel_hotel_virtual_room_restriction_tree" model="ir.ui.view">
<field name="name">channel.hotel.virtual.room.restriction.tree</field>
<field name="model">channel.hotel.virtual.restriction.room</field>
<field name="arch" type="xml">
<tree string="Hotel Channel Room Restriction">
<field name="backend_id"/>
</tree>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_channel_product_pricelist_form" model="ir.ui.view">
<field name="name">channel.product.pricelist.form</field>
<field name="model">channel.product.pricelist</field>
<field name="arch" type="xml">
<form string="Hotel Channel Product Pricelist">
<group>
<field name="channel_plan_id" />
<field name="is_daily_plan" />
</group>
</form>
</field>
</record>
<record id="view_channel_hotel_virtual_room_restriction_tree" model="ir.ui.view">
<field name="name">channel.hotel.product.pricelist.tree</field>
<field name="model">channel.hotel.product.pricelist.room</field>
<field name="arch" type="xml">
<tree string="Hotel Channel Product Pricelist">
<field name="backend_id"/>
</tree>
</field>
</record>
</odoo>

View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Backend stuff -->
<template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/hotel_channel_connector/static/src/js/wubook_listview_import_buttons.js"></script>
</xpath>
</template>
<!-- Backend stuff -->
<template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/hotel_channel_connector/static/src/js/wubook_listview_import_buttons.js"></script>
</xpath>
</template>
</odoo>

View File

@@ -1,71 +1,72 @@
<?xml version="1.0"?>
<odoo>
<!-- FORM issue -->
<record id="hotel_channel_connector_issue_view_form" model="ir.ui.view">
<field name="name">hotel.channel.coonector.issue.form</field>
<field name="model">hotel.channel.coonector.issue</field>
<field name="arch" type="xml">
<form string="Channel Connector Issue">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_to_read" type="object" class="oe_stat_button" icon="fa-eye">
<field name="to_read" widget="boolean_button" options='{"terminology": "see"}'/>
</button>
<button name="mark_as_read" type="object"
string="Mark as Readed"
groups="hotel.group_hotel_manager"
class="oe_stat_button" icon="fa-warning"
attrs="{'invisible':['|', ['section', '!=', 'reservation'], ['wid', '=', False]]}"/>
</div>
<group>
<field name="section"/>
<field name="internal_message"/>
</group>
<group>
<field name="date_start"/>
<field name="date_end"/>
</group>
<group>
<field name="channel_object_id"/>
<field name="channel_message"/>
</group>
</sheet>
</form>
</field>
</record>
<!-- FORM issue -->
<record id="hotel_channel_connector_issue_view_form" model="ir.ui.view">
<field name="name">hotel.channel.coonector.issue.form</field>
<field name="model">hotel.channel.coonector.issue</field>
<field name="arch" type="xml">
<form string="Channel Connector Issue">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_to_read" type="object" class="oe_stat_button" icon="fa-eye">
<field name="to_read" widget="boolean_button" options='{"terminology": "see"}'/>
</button>
<button name="mark_as_read" type="object"
string="Mark as Readed"
groups="hotel.group_hotel_manager"
class="oe_stat_button" icon="fa-warning"
attrs="{'invisible':['|', ['section', '!=', 'reservation'], ['wid', '=', False]]}"/>
</div>
<group>
<field name="section"/>
<field name="internal_message"/>
</group>
<group>
<field name="date_start"/>
<field name="date_end"/>
</group>
<group>
<field name="channel_object_id"/>
<field name="channel_message"/>
</group>
</sheet>
</form>
</field>
</record>
<!-- TREE issue -->
<record id="hotel_channel_connector_issue_view_tree" model="ir.ui.view">
<field name="name">hotel.channel.coonector.issue.tree</field>
<field name="model">hotel.channel.coonector.issue</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Channel Connector Issues">
<field name="create_date"/>
<field name="section"/>
<field name="internal_message"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="channel_object_id"/>
</tree>
</field>
</record>
<!-- TREE issue -->
<record id="hotel_channel_connector_issue_view_tree" model="ir.ui.view">
<field name="name">hotel.channel.coonector.issue.tree</field>
<field name="model">hotel.channel.coonector.issue</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Channel Connector Issues">
<field name="create_date"/>
<field name="section"/>
<field name="internal_message"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="channel_object_id"/>
</tree>
</field>
</record>
<!-- SEARCH issue -->
<record id="view_hotel_channel_connector_issue_form_search" model="ir.ui.view">
<field name="name">hotel.channel.coonector.issue.search</field>
<field name="model">hotel.channel.coonector.issue</field>
<field name="arch" type="xml">
<search string="Issues">
<field name="create_date"/>
<field name="section"/>
<field name="internal_message"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="channel_object_id"/>
<field name="to_read"/>
</search>
</field>
</record>
</odoo>
<!-- SEARCH issue -->
<record id="view_hotel_channel_connector_issue_form_search" model="ir.ui.view">
<field name="name">hotel.channel.coonector.issue.search</field>
<field name="model">hotel.channel.coonector.issue</field>
<field name="arch" type="xml">
<search string="Issues">
<field name="create_date"/>
<field name="section"/>
<field name="internal_message"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="channel_object_id"/>
<field name="to_read"/>
</search>
</field>
</record>
</odoo>

View File

@@ -6,8 +6,8 @@
<field name="inherit_id" ref="hotel.view_hotel_folio1_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_internal_comment']" position="before">
<field name="whas_wubook_reservations" invisible="True" />
<field name="wcustomer_notes" readonly="True" attrs="{'invisible':[('whas_wubook_reservations', '=', False)]}"/>
<field name="has_channel_reservations" invisible="True" />
<field name="customer_notes" readonly="True" attrs="{'invisible':[('has_channel_reservations', '=', False)]}"/>
</xpath>
</field>
</record>

View File

@@ -6,7 +6,7 @@
<field name="inherit_id" ref="hotel.view_hotel_reservation_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='channel_type']" position="after">
<field name="wchannel_id" attrs='{"readonly": [("able_to_modify_wubook","=",False)], "invisible":[("channel_type","!=", "web")]}' string="OTA"/>
<field name="channel_reservation_id" attrs='{"readonly": [("able_to_modify_channel","=",False)], "invisible":[("channel_type","!=", "web")]}' string="OTA"/>
</xpath>
<xpath expr="//field[@name='cardex_pending']" position="before">
<group colspan="6" col="6">
@@ -15,44 +15,43 @@
</xpath>
<xpath expr="//field[@name='partner_internal_comment']" position="after">
<field name="able_to_modify_wubook" invisible="True"/>
<field name="customer_notes" readonly="1"
attrs="{'invisible': [('wrid','=',False)]}"
<field name="able_to_modify_channel" invisible="True"/>
<!-- <field name="customer_notes" readonly="1"
attrs="{'invisible': [('channel_reservation_id','=',False)]}"
nolabel="1" colspan="2"
/>
/> -->
</xpath>
<xpath expr="//page[@name='days']" position="after">
<page name="wubook" string="Wubook">
<group colspan="4" col="4">
<field name="channel_reservation_id" attrs='{"readonly": [("able_to_modify_wubook","=",False)]}'/>
<field name="ota_reservation_code" attrs='{"readonly": [("able_to_modify_wubook","=",False)]}'/>
<field name="wstatus" attrs='{"readonly": [("able_to_modify_wubook","=",False)]}'/>
<field name="wstatus_reason" attrs='{"readonly": [("able_to_modify_wubook","=",False)]}'/>
<field name="to_read" invisible="0"/>
<field name="to_assign" invisible="0" />
<page name="connector">
<group string="Hotel Channel Bindings">
<field name="channel_bind_ids" nolabel="1">
<tree>
<field name="backend_id"/>
</tree>
</field>
</group>
</page>
</xpath>
<!-- ALLOW ONLY-READ -->
<xpath expr="//field[@name='adults']" position="attributes">
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_wubook','=',False)]}</attribute>
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]}</attribute>
</xpath>
<xpath expr="//field[@name='virtual_room_id']" position="attributes">
<attribute name="attrs">{'readonly': [('channel_reservation_id','!=',False),('able_to_modify_wubook','=',False)]}</attribute>
<xpath expr="//field[@name='room_type_id']" position="attributes">
<attribute name="attrs">{'readonly': [('channel_reservation_id','!=',False),('able_to_modify_channel','=',False)]}</attribute>
</xpath>
<xpath expr="//field[@name='children']" position="attributes">
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_wubook','=',False)]}</attribute>
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]}</attribute>
</xpath>
<xpath expr="//field[@name='checkin']" position="attributes">
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_wubook','=',False)]}</attribute>
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]}</attribute>
</xpath>
<xpath expr="//field[@name='checkout']" position="attributes">
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_wubook','=',False)]}</attribute>
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]}</attribute>
</xpath>
<xpath expr="//field[@name='reservation_line_ids']" position="attributes">
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_wubook','=',False)]}</attribute>
<attribute name="attrs">{'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]}</attribute>
</xpath>
</field>
</record>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<odoo>
<record id="virtual_room_view_form" model="ir.ui.view">
<field name="model">hotel.room.type</field>
<field name="inherit_id" ref="hotel.view_hotel_room_type_form" />
<field name="arch" type="xml">
<xpath expr="//sheet" position="inside">
<notebook>
<page name="connector">
<group string="Hotel Channel Bindings">
<field name="channel_bind_ids" nolabel="1">
<tree>
<field name="backend_id"/>
</tree>
</field>
</group>
</page>
</notebook>
</xpath>
</field>
</record>
</odoo>

View File

@@ -6,9 +6,19 @@
<field name="model">hotel.virtual.room.availability</field>
<field name="inherit_id" ref="hotel.virtual_room_availability_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='avail']" position="after">
<field name="channel_max_avail" />
</xpath>
<xpath expr="//sheet" position="inside">
<notebook>
<page name="connector">
<group string="Hotel Channel Bindings">
<field name="channel_bind_ids" nolabel="1">
<tree>
<field name="backend_id"/>
</tree>
</field>
</group>
</page>
</notebook>
</xpath>
</field>
</record>
@@ -18,9 +28,9 @@
<field name="inherit_id" ref="hotel.virtual_room_availability_view_tree" />
<field name="type">tree</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='avail']" position="after">
<!-- <xpath expr="//field[@name='avail']" position="after">
<field name="channel_max_avail" />
</xpath>
</xpath> -->
</field>
</record>
</odoo>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0"?>
<odoo>
<record id="virtual_room_view_form" model="ir.ui.view">
<field name="model">hotel.room.type</field>
<field name="inherit_id" ref="hotel.virtual_room_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="channel_short_code" maxlength="4" readonly="True" />
<field name="channel_reservation_id" readonly="True" />
<field name="ota_capacity" />
</xpath>
</field>
</record>
</odoo>

View File

@@ -2,18 +2,17 @@
<odoo>
<record id="product_pricelist_item_form_view" model="ir.ui.view">
<field name="model">product.pricelist.item</field>
<field name="inherit_id" ref="product.product_pricelist_item_form_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="channel_pushed" readonly="True" />
<field name="is_daily_plan" invisible="1" />
</xpath>
<xpath expr="//field[@name='date_end']" position="attributes">
<attribute name="attrs">{'readonly': [('is_daily_plan', '=', True)]}</attribute>
</xpath>
</field>
</record>
<field name="model">product.pricelist.item</field>
<field name="inherit_id" ref="product.product_pricelist_item_form_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="channel_pushed" readonly="True" />
<field name="is_daily_plan" invisible="1" />
</xpath>
<xpath expr="//field[@name='date_end']" position="attributes">
<attribute name="attrs">{'readonly': [('is_daily_plan', '=', True)]}</attribute>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,30 +1,18 @@
<?xml version="1.0"?>
<odoo>
<record id="product_pricelist_view" model="ir.ui.view">
<record id="product_pricelist_view" model="ir.ui.view">
<field name="model">product.pricelist</field>
<field name="inherit_id" ref="product.product_pricelist_view" />
<field name="arch" type="xml">
<xpath expr="//form[1]//sheet" position="before">
<header>
<button name="%(action_channel_import_plan_prices)d" string="Import Prices From Channel" type="action" class="oe_highlight" />
</header>
</xpath>
<xpath expr="//field[@name='company_id']" position="after">
<field name="id" invisible="1"/>
<field name="channel_plan_id" />
<field name="is_daily_plan" widget="checkbox" attrs="{'readonly':[('id', '>', 0)]}" />
</xpath>
</field>
</record>
<record id="product_pricelist_view_tree" model="ir.ui.view">
<field name="model">product.pricelist</field>
<field name="inherit_id" ref="product.product_pricelist_view_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="is_daily_plan" widget="checkbox" readonly="True" />
</xpath>
<xpath expr="//form[1]//sheet" position="before">
<header>
<button name="%(action_channel_import_plan_prices)d" string="Import Prices From Channel" type="action" class="oe_highlight" />
</header>
</xpath>
<xpath expr="//field[@name='company_id']" position="after">
<field name="id" invisible="1"/>
</xpath>
</field>
</record>

View File

@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='parent_id']" position="after">
<group>
<field name="unconfirmed" invisible="1"/>
</group>
</xpath>
</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='parent_id']" position="after">
<group>
<field name="unconfirmed" invisible="1"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>
</odoo>

View File

@@ -2,13 +2,13 @@
<odoo>
<record id="reservation_restriction_item_form_view" model="ir.ui.view">
<field name="model">hotel.virtual.room.restriction.item</field>
<field name="inherit_id" ref="hotel.reservation_restriction_item_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='date_end']" position="attributes">
<attribute name="readonly">True</attribute>
</xpath>
</field>
</record>
<field name="model">hotel.virtual.room.restriction.item</field>
<field name="inherit_id" ref="hotel.reservation_restriction_item_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='date_end']" position="attributes">
<attribute name="readonly">True</attribute>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,19 +1,15 @@
<?xml version="1.0"?>
<odoo>
<record id="reservation_restriction_view" model="ir.ui.view">
<record id="reservation_restriction_view" model="ir.ui.view">
<field name="model">hotel.virtual.room.restriction</field>
<field name="inherit_id" ref="hotel.reservation_restriction_view_form" />
<field name="arch" type="xml">
<xpath expr="//form[1]//sheet" position="before">
<header>
<button name="%(action_channel_import_plan_restrictions)d" string="Import Restrictions From Channel" type="action" class="oe_highlight" />
</header>
</xpath>
<xpath expr="//field[@name='active']" position="after">
<field name="channel_plan_id" />
<field name="is_daily_plan" />
</xpath>
<xpath expr="//form[1]//sheet" position="before">
<header>
<button name="%(action_channel_import_plan_restrictions)d" string="Import Restrictions From Channel" type="action" class="oe_highlight" />
</header>
</xpath>
</field>
</record>

View File

@@ -1,118 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Hotel Channel Connector Settings -->
<record id="view_hotel_config_settings" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.hotel.channel.connector</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="80"/>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside">
<div class="app_settings_block" data-string="Hotel" string="Hotel" data-key="hotel" groups="hotel.group_hotel_manager">
<h2>Hotel Parity</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box">
<label for="parity_pricelist_id"/>
<div class="text-muted">
Set pricelist parity
</div>
<div class="content-group">
<div class="mt16">
<field name="parity_pricelist_id" required="True" />
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<label for="parity_restrictions_id"/>
<div class="text-muted">
Set restrictions parity
</div>
<div class="content-group">
<div class="mt16">
<field name="parity_restrictions_id" required="True" />
</div>
</div>
</div>
</div>
<h2>Hotel Default Hours</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-12 o_setting_box">
<label for="tz_hotel"/>
<div class="text-muted">
Set time-zone
</div>
<div class="content-group">
<div class="mt16">
<field name="tz_hotel"/>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<label for="default_arrival_hour"/>
<div class="text-muted">
Set default arrival hour
</div>
<div class="content-group">
<div class="mt16">
<field name="default_arrival_hour" required="True" />
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<label for="default_departure_hour"/>
<div class="text-muted">
Set default departure hour
</div>
<div class="content-group">
<div class="mt16">
<field name="default_departure_hour" required="True" />
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
<!-- WuBook config wizard -->
<record id="view_wubook_config_settings" model="ir.ui.view">
<field name="name">Channel Settings</field>
<field name="model">res.config.settings</field>
<field name="arch" type="xml">
<form string="Configure Channel" class="oe_form_configuration">
<header>
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
<button string="Cancel" type="object" name="cancel" class="oe_link"/>
</header>
<sheet>
<div class=" oe_button_box">
<button type="object" class="oe_stat_button"
icon="fa-recycle"
name="resync"
context="">
<div class="o_form_field o_stat_info">
<span class="o_stat_text">ReSync</span>
</div>
</button>
</div>
<div id="main">
<group name="wubook_details" string="WuBook Details">
<group>
<field name="wubook_server" />
<field name="wubook_pkey" />
<field name="wubook_lcode" />
</group>
<group>
<field name="wubook_user" />
<field name="wubook_passwd" password="True" />
</group>
</group>
</div>
</sheet>
</form>
</field>
</record>
</odoo>