mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
Merge pull request #90 from hootel/pr_popover_and_cleanup
Pr popover and cleanup
This commit is contained in:
@@ -193,7 +193,7 @@
|
||||
<field name="per_person">False</field>
|
||||
<field name="daily_limit">1</field>
|
||||
<field name="is_extra_bed">True</field>
|
||||
<field name="is_popoverable">True</field>
|
||||
<field name="show_in_calendar">True</field>
|
||||
</record>
|
||||
|
||||
<record id="hotel_service_3" model="product.product">
|
||||
@@ -206,7 +206,7 @@
|
||||
</record>
|
||||
|
||||
<record id="hotel_service_4" model="product.product">
|
||||
<field name="name">Menú A</field>
|
||||
<field name="name">Lunch</field>
|
||||
<field name="list_price">15.0</field>
|
||||
<field name="type">service</field>
|
||||
<field name="purchase_ok">False</field>
|
||||
@@ -215,7 +215,7 @@
|
||||
</record>
|
||||
|
||||
<record id="hotel_service_5" model="product.product">
|
||||
<field name="name">Menú B</field>
|
||||
<field name="name">Dinner</field>
|
||||
<field name="list_price">20.0</field>
|
||||
<field name="type">service</field>
|
||||
<field name="purchase_ok">False</field>
|
||||
@@ -224,8 +224,8 @@
|
||||
</record>
|
||||
|
||||
<record id="hotel_service_6" model="product.product">
|
||||
<field name="name">Menú C</field>
|
||||
<field name="list_price">25.0</field>
|
||||
<field name="name">Free Bar</field>
|
||||
<field name="list_price">40.0</field>
|
||||
<field name="type">service</field>
|
||||
<field name="purchase_ok">False</field>
|
||||
<field name="per_day">True</field>
|
||||
@@ -249,7 +249,7 @@
|
||||
eval="[(5, 0), (0, 0, {
|
||||
'product_id': ref('hotel_service_0'),
|
||||
'amount': 3}),
|
||||
(0, 0, {'product_id': ref('hotel_service_4'),
|
||||
(0, 0, {'product_id': ref('hotel_service_5'),
|
||||
'amount': 8})
|
||||
]"/>
|
||||
<field name="price_type">fixed</field>
|
||||
@@ -271,7 +271,7 @@
|
||||
|
||||
<!-- hotel.board.service.room.type -->
|
||||
|
||||
<!--Room 0 Economic-->
|
||||
<!--Room 0 Economic-->
|
||||
|
||||
<record id="hotel_board_service_room_0"
|
||||
model="hotel.board.service.room.type">
|
||||
|
||||
@@ -11,5 +11,5 @@ class ProductTemplate(models.Model):
|
||||
per_person = fields.Boolean('Unit increment per person')
|
||||
daily_limit = fields.Integer('Daily limit')
|
||||
is_extra_bed = fields.Boolean('Is extra bed', default=False)
|
||||
is_popoverable = fields.Boolean('Show in Popover', default=False,
|
||||
help='Specifies if the product is shown in the popover information.')
|
||||
show_in_calendar = fields.Boolean('Show in Calendar', default=False,
|
||||
help='Specifies if the product is shown in the calendar information.')
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<group>
|
||||
<field name="is_extra_bed" />
|
||||
<field name="daily_limit" />
|
||||
<field name="is_popoverable" />
|
||||
<field name="show_in_calendar" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="per_day" />
|
||||
|
||||
@@ -52,7 +52,7 @@ class BusHotelCalendar(models.TransientModel):
|
||||
'real_dates': vals['real_dates'],
|
||||
},
|
||||
'tooltip': {
|
||||
'folio_name': vals['folio_id'],
|
||||
'folio_name': vals['folio_name'],
|
||||
'name': vals['partner_name'],
|
||||
'phone': vals['partner_phone'],
|
||||
'email': vals['partner_email'],
|
||||
@@ -63,9 +63,9 @@ class BusHotelCalendar(models.TransientModel):
|
||||
'checkout': vals['checkout'],
|
||||
'arrival_hour': vals['arrival_hour'],
|
||||
'departure_hour': vals['departure_hour'],
|
||||
'amount_total': vals['amount_total'],
|
||||
'price_room_services_set': vals['price_room_services_set'],
|
||||
'invoices_paid': vals['invoices_paid'],
|
||||
'pending_amount': vals['pending_amount'],
|
||||
'amount_paid': vals['amount_paid'],
|
||||
'type': vals['reservation_type'],
|
||||
'closure_reason': vals['closure_reason'],
|
||||
'out_service_description': vals['out_service_description'],
|
||||
|
||||
@@ -95,7 +95,7 @@ class HotelReservation(models.Model):
|
||||
'real_dates': [reserv['real_checkin'], reserv['real_checkout']]})
|
||||
json_reservation_tooltips.update({
|
||||
reserv['id']: {
|
||||
'folio_name': reserv['folio_id'],
|
||||
'folio_name': reserv['folio_name'],
|
||||
'name': _('Out of service')
|
||||
if reserv['reservation_type'] == 'out'
|
||||
else reserv['partner_name'],
|
||||
@@ -109,9 +109,9 @@ class HotelReservation(models.Model):
|
||||
'checkout': reserv['checkout'],
|
||||
'arrival_hour': reserv['arrival_hour'],
|
||||
'departure_hour': reserv['departure_hour'],
|
||||
'amount_total': reserv['amount_total'],
|
||||
'price_room_services_set': reserv['price_room_services_set'],
|
||||
'invoices_paid': reserv['invoices_paid'],
|
||||
'pending_amount': reserv['pending_amount'],
|
||||
'amount_paid': reserv['amount_total'] - (reserv['pending_amount'] or 0.0),
|
||||
'type': reserv['reservation_type'] or 'normal',
|
||||
'closure_reason': reserv['closure_reason'],
|
||||
'out_service_description': reserv['out_service_description']
|
||||
@@ -119,8 +119,7 @@ class HotelReservation(models.Model):
|
||||
'splitted': reserv['splitted'],
|
||||
'channel_type': reserv['channel_type'],
|
||||
'real_dates': [reserv['real_checkin'], reserv['real_checkout']],
|
||||
# TODO: Add Board Services and Extra Service as Cradle, Bed, ...
|
||||
'board_service_name': reserv['board_service_name'],
|
||||
'board_service_name': reserv['board_service_name'] or _('No board services'),
|
||||
'services': reserv['services'],
|
||||
}
|
||||
})
|
||||
@@ -190,14 +189,15 @@ class HotelReservation(models.Model):
|
||||
hr.id, hr.room_id, hr.adults, hr.children, hr.checkin, hr.checkout, hr.reserve_color, hr.reserve_color_text,
|
||||
hr.splitted, hr.parent_reservation, hr.overbooking, hr.state, hr.real_checkin, hr.real_checkout,
|
||||
hr.out_service_description, hr.arrival_hour, hr.departure_hour, hr.channel_type,
|
||||
hr.price_room_services_set,
|
||||
|
||||
hf.id as folio_id, hf.name as folio_name, hf.reservation_type, hf.amount_total, hf.pending_amount,
|
||||
hf.id as folio_id, hf.name as folio_name, hf.reservation_type, hf.invoices_paid, hf.pending_amount,
|
||||
|
||||
rp.mobile, rp.phone, rp.email, rp.name as partner_name,
|
||||
|
||||
pt.name as room_type,
|
||||
|
||||
array_agg(pt2.name) FILTER (WHERE pt2.is_popoverable = TRUE) as services,
|
||||
array_agg(pt2.name) FILTER (WHERE pt2.show_in_calendar = TRUE) as services,
|
||||
|
||||
rcr.name as closure_reason,
|
||||
|
||||
@@ -393,6 +393,7 @@ class HotelReservation(models.Model):
|
||||
'title': ntitle,
|
||||
'room_id': self.room_id.id,
|
||||
'reserv_id': self.id,
|
||||
'folio_name': self.folio_id.name,
|
||||
'partner_name': (self.closure_reason_id.name or _('Out of service'))
|
||||
if self.reservation_type == 'out' else self.partner_id.name,
|
||||
'adults': self.adults,
|
||||
@@ -415,18 +416,18 @@ class HotelReservation(models.Model):
|
||||
'state': self.state,
|
||||
'fix_days': self.splitted,
|
||||
'overbooking': self.overbooking,
|
||||
'amount_total': self.folio_id.amount_total,
|
||||
'price_room_services_set': self.price_room_services_set,
|
||||
'invoices_paid': self.folio_id.invoices_paid,
|
||||
'pending_amount': self.folio_id.pending_amount,
|
||||
'amount_paid': self.folio_id.amount_total - self.folio_id.pending_amount,
|
||||
'reservation_type': self.reservation_type or 'normal',
|
||||
'closure_reason': self.closure_reason_id.name,
|
||||
'out_service_description': self.out_service_description
|
||||
or _('No reason given'),
|
||||
'real_dates': [self.real_checkin, self.real_checkout],
|
||||
'channel_type': self.channel_type,
|
||||
'board_service_name': self.board_service_room_id.hotel_board_service_id.name,
|
||||
'board_service_name': self.board_service_room_id.hotel_board_service_id.name or _('No board services'),
|
||||
'services': [service.product_id.name for service in self.service_ids
|
||||
if service.product_id.is_popoverable] or False,
|
||||
if service.product_id.show_in_calendar] or False,
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -224,73 +224,118 @@ input#bookings_search {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/** TOOLTIPS **/
|
||||
/** POPOVER **/
|
||||
.popover-content {
|
||||
font-family: Garuda, sans-serif;
|
||||
font-size: 12px;
|
||||
padding: 9px;
|
||||
font-family: Garuda, sans-serif;
|
||||
font-size: 12px;
|
||||
padding: 0px;
|
||||
}
|
||||
.popover h1, .h1, h2, .h2, h3, .h3 {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 0px;
|
||||
.popover .h3, .popover h3 {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.popover {
|
||||
max-width: 550px;
|
||||
border-radius: 0px;
|
||||
max-width: 400px;
|
||||
border-radius: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
.popover .container {
|
||||
max-width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
.popover .container p {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 0px;
|
||||
margin-top: 2px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.popover .container p.email {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.popover .container p.board {
|
||||
margin-top: 0px;
|
||||
}
|
||||
.popover header {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
.popover .fa-border {
|
||||
padding: .25em;
|
||||
border: solid 0.1em #777777;
|
||||
border-radius: .2em;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.fa-2_5x {
|
||||
font-size: 2.5em;
|
||||
}
|
||||
.fa-text-inside {
|
||||
font-family: Garuda, sans-serif;
|
||||
font-size: 14px;
|
||||
font-family: Garuda, sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
.popover .col-sm-2, .popover .col-sm-4, .popover .col-sm-6, .popover .col-sm-12 {
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
/* custom styles for popover info */
|
||||
.popover .circle {
|
||||
height:35px;
|
||||
min-width:35px;
|
||||
line-height:35px;
|
||||
border-radius:50px;
|
||||
text-align:center;
|
||||
color:#fff;
|
||||
background:#777;
|
||||
margin-right: .65em;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.popover .bg-gray-lighter {
|
||||
background-color: #ddd;
|
||||
color: #777;
|
||||
}
|
||||
.popover .text-gray-dark {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
|
||||
/* Spacing in Bootstrap v4.0 */
|
||||
.mt-3 {
|
||||
margin-top: 3px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
.mt-5 {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.mt-10 {
|
||||
margin-top: 10px !important;
|
||||
margin-top: 10px !important;
|
||||
}
|
||||
.my-10 {
|
||||
margin-top: 10px !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
.mt-25 {
|
||||
margin-top: 25px;
|
||||
margin-top: 25px;
|
||||
}
|
||||
.mr-5 {
|
||||
margin-right: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.mx-15 {
|
||||
margin-left: 15px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.mx-25 {
|
||||
margin-left: 25px;
|
||||
margin-right: 25px;
|
||||
margin-left: 25px;
|
||||
margin-right: 25px;
|
||||
}
|
||||
.px-0 {
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
.py-5 {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.pb-3 {
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
.pb-10 {
|
||||
padding-bottom: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
@media (min-width:0px) and (max-width: 1600px) {
|
||||
/* .text-hidden-xs {
|
||||
visibility: hidden;
|
||||
} */
|
||||
.pl-5 {
|
||||
padding-left: 5px;
|
||||
}
|
||||
.pr-0 {
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
/* WARNING: The .row-eq-height class uses CSS3's flexbox layout mode,
|
||||
@@ -303,3 +348,44 @@ input#bookings_search {
|
||||
}
|
||||
|
||||
/* TODO: Use Odoo Colours based on http://www.odoo.com/openerp_website/static/src/less/variables.less */
|
||||
|
||||
div.diagonal {
|
||||
overflow: hidden;
|
||||
background-color: #777;
|
||||
}
|
||||
.diagonal:before {
|
||||
content: "";
|
||||
border-top: 700px solid #777;
|
||||
border-right: 500px solid #ddd;
|
||||
position: absolute;
|
||||
left: 40%;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
div.triangle-right {
|
||||
overflow: hidden;
|
||||
color: white;
|
||||
background-color: #7c7bad;
|
||||
}
|
||||
.triangle-right:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border: 26px solid #ddd;
|
||||
height: 0;
|
||||
width: 100%;
|
||||
left: 47%;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
border-left-color: transparent;
|
||||
}
|
||||
|
||||
div.on-top {
|
||||
position: inherit;
|
||||
}
|
||||
div.pull-right-custom {
|
||||
float: right !important;
|
||||
margin-right: 15px;
|
||||
color: #777;
|
||||
text-align: right;
|
||||
}
|
||||
@@ -420,7 +420,7 @@ var PMSCalendarController = AbstractController.extend({
|
||||
type: 'ir.actions.act_window',
|
||||
res_model: 'hotel.folio',
|
||||
res_id: ev.data.folio_id,
|
||||
views: [[false, 'form']]
|
||||
views: [[false, 'form']],
|
||||
});
|
||||
});
|
||||
$reservationPopover.data('bs.popover').tip().find(".btn_popover_open_reservation").on('click',
|
||||
@@ -433,6 +433,57 @@ var PMSCalendarController = AbstractController.extend({
|
||||
views: [[false, 'form']]
|
||||
});
|
||||
});
|
||||
$reservationPopover.data('bs.popover').tip().find(".btn_popover_open_payment").on('click',
|
||||
{reservation_id: ev.detail.reservationObj.id}, function(ev){
|
||||
_destroy_and_clear_popover_mark();
|
||||
var x = self._rpc({
|
||||
model: 'hotel.reservation',
|
||||
method: 'action_pay_folio',
|
||||
args: [ev.data.reservation_id],
|
||||
}).then(function (result){
|
||||
return self.do_action({
|
||||
name: result.name,
|
||||
view_type: result.view_type,
|
||||
view_mode: result.view_mode,
|
||||
type: result.type,
|
||||
res_model: result.res_model,
|
||||
views: [[result.view_id, 'form']],
|
||||
context: result.context,
|
||||
target: result.target,
|
||||
});
|
||||
});
|
||||
});
|
||||
$reservationPopover.data('bs.popover').tip().find(".btn_popover_open_checkin").on('click',
|
||||
{reservation_id: ev.detail.reservationObj.id}, function(ev){
|
||||
_destroy_and_clear_popover_mark();
|
||||
var x = self._rpc({
|
||||
model: 'hotel.reservation',
|
||||
method: 'action_checks',
|
||||
args: [ev.data.reservation_id],
|
||||
}).then(function (result){
|
||||
return self.do_action({
|
||||
name: result.name,
|
||||
view_type: result.view_type,
|
||||
view_mode: result.view_mode,
|
||||
type: result.type,
|
||||
res_model: result.res_model,
|
||||
views: [[false, 'form']],
|
||||
domain: result.domain,
|
||||
target: result.target,
|
||||
});
|
||||
});
|
||||
});
|
||||
$reservationPopover.data('bs.popover').tip().find(".btn_popover_open_invoice").on('click',
|
||||
{reservation_id: ev.detail.reservationObj.id}, function(ev){
|
||||
_destroy_and_clear_popover_mark();
|
||||
var x = self._rpc({
|
||||
model: 'hotel.reservation',
|
||||
method: 'open_invoices_reservation',
|
||||
args: [ev.data.reservation_id],
|
||||
}).then(function (result){
|
||||
return self.do_action(result);
|
||||
});
|
||||
});
|
||||
$reservationPopover.data('bs.popover').tip().find(".btn_popover_close").on('click', function(ev){
|
||||
_destroy_and_clear_popover_mark();
|
||||
});
|
||||
@@ -699,6 +750,10 @@ var PMSCalendarController = AbstractController.extend({
|
||||
}).open();
|
||||
});
|
||||
|
||||
this._multi_calendar.on_calendar('hcalOnKeyPressed', function(ev){
|
||||
/* add actions */
|
||||
});
|
||||
|
||||
this._multi_calendar.on_calendar('hcalOnDateChanged', function(ev){
|
||||
var $dateTimePickerBegin = this.renderer.$el.find('#pms-menu #date_begin');
|
||||
$dateTimePickerBegin.data("ignore_onchange", true);
|
||||
@@ -754,9 +809,9 @@ var PMSCalendarController = AbstractController.extend({
|
||||
'checkout_day_of_week': HotelCalendar.toMomentUTC(tp['real_dates'][1], '').format("dddd"),
|
||||
'arrival_hour': tp['arrival_hour'],
|
||||
'departure_hour': tp['departure_hour'],
|
||||
'amount_total': Number(tp['amount_total']).toLocaleString(),
|
||||
'price_room_services_set': Number(tp['price_room_services_set']).toLocaleString(),
|
||||
'invoices_paid': Number(tp['invoices_paid']).toLocaleString(),
|
||||
'pending_amount': Number(tp['pending_amount']).toLocaleString(),
|
||||
'amount_paid': Number(tp['amount_paid']).toLocaleString(),
|
||||
'reservation_type': tp['type'],
|
||||
'closure_reason': tp['closure_reason'],
|
||||
'out_service_description': tp['out_service_description'],
|
||||
|
||||
@@ -464,7 +464,7 @@ td.hcal-cell-room-type-group-day {
|
||||
td.hcal-cell-room-type-group-item {
|
||||
text-align: center !important;
|
||||
vertical-align: middle;
|
||||
font-size: x-small;
|
||||
font-size: smaller;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@@ -761,13 +761,14 @@ HotelCalendar.prototype = {
|
||||
cell.classList.add('hcal-cell-room-type-group-item');
|
||||
cell.classList.add('btn-hcal');
|
||||
cell.classList.add('btn-hcal-3d');
|
||||
cell.setAttribute('colspan', '2');
|
||||
cell.setAttribute('colspan', '3');
|
||||
/*
|
||||
cell = row.insertCell();
|
||||
cell.textContent = ex_room.type;
|
||||
cell.classList.add('hcal-cell-room-type-group-item');
|
||||
cell.classList.add('btn-hcal');
|
||||
cell.classList.add('btn-hcal-flat');
|
||||
|
||||
*/
|
||||
var now = moment();
|
||||
for (var i=0; i<=this.options.days; i++) {
|
||||
var dd = this.options.startDate.clone().local().startOf('day').add(i,'d').utc();
|
||||
@@ -1154,12 +1155,14 @@ HotelCalendar.prototype = {
|
||||
cell.classList.add('hcal-cell-room-type-group-item');
|
||||
cell.classList.add('btn-hcal');
|
||||
cell.classList.add('btn-hcal-left');
|
||||
cell.setAttribute('colspan', '2');
|
||||
cell.setAttribute('colspan', '3');
|
||||
/*
|
||||
cell = row.insertCell();
|
||||
cell.textContent = itemRoom.type;
|
||||
cell.classList.add('hcal-cell-room-type-group-item');
|
||||
cell.classList.add('btn-hcal');
|
||||
cell.classList.add('btn-hcal-flat');
|
||||
*/
|
||||
for (var i=0; i<=$this.options.days; i++) {
|
||||
var dd = $this.options.startDate.clone().local().startOf('day').add(i,'d').utc();
|
||||
var dd_local = dd.clone().local();
|
||||
@@ -2075,7 +2078,6 @@ HotelCalendar.prototype = {
|
||||
'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId)
|
||||
});
|
||||
}, false);
|
||||
*/
|
||||
rdiv.addEventListener('mouseleave', function(ev){
|
||||
$this._dispatchEvent(
|
||||
'hcalOnMouseLeaveReservation',
|
||||
@@ -2085,6 +2087,7 @@ HotelCalendar.prototype = {
|
||||
'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId)
|
||||
});
|
||||
}, false);
|
||||
*/
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2487,7 +2490,12 @@ HotelCalendar.prototype = {
|
||||
};
|
||||
this._splitReservation = false;
|
||||
this._splitDate = false;
|
||||
} else if ($(".marked-as-having-a-popover").length === 1) {
|
||||
// TODO: better call _destroy_and_clear_popover_mark defined in hotel_calendar_controller.js
|
||||
$(".marked-as-having-a-popover").popover('destroy');
|
||||
$('.hcal-reservation').removeClass("marked-as-having-a-popover");
|
||||
} else {
|
||||
// FIXME: Prevent multiple clicks in a row
|
||||
this._cellSelection.start = this._cellSelection.current = ev.target;
|
||||
this._cellSelection.end = false;
|
||||
this._updateCellSelection();
|
||||
|
||||
@@ -109,59 +109,52 @@
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="HotelCalendar.TooltipReservation.Footer">
|
||||
<div class="row row-eq-height mt-10">
|
||||
<div class="col-sm-2 btn_popover_open_folio">
|
||||
<i class="fa fa-file-text-o fa-2x fa-pull-left" role="button"
|
||||
title="View Folio Details"> <span class="fa-text-inside"><t t-esc="folio_name"/></span></i>
|
||||
<t t-name="HotelCalendar.TooltipReservation.Customer">
|
||||
<div class="row row-eq-height">
|
||||
<div class="col-sm-6 bg-gray-light">
|
||||
<i class="fa fa-user-circle fa-2x fa-pull-left mt-5"/>
|
||||
<header><t t-esc="name"/></header>
|
||||
<p><t t-esc="phone"/></p>
|
||||
<p class="email"><t t-esc="email"/></p>
|
||||
</div>
|
||||
<div class="col-sm-2 btn_popover_open_reservation">
|
||||
<span class="fa fa-suitcase fa-2x" role="button"
|
||||
title="View Reservation Details" />
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<span class="fa fa-user-plus fa-2x" role="button"
|
||||
title="Checkin" />
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<span class="fa fa-envelope fa-2x" role="button"
|
||||
title="Send Reservation Email" />
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<span class="fa fa-money fa-2x" role="button"
|
||||
title="Payments" />
|
||||
</div>
|
||||
<div class="col-sm-2 btn_popover_close">
|
||||
<span class="fa fa-window-close fa-2x" role="button"
|
||||
title="Close" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-eq-height mt-10">
|
||||
<div class="col-sm-12">
|
||||
<t t-if="services">
|
||||
<t t-foreach='services' t-as='ps'>
|
||||
<i class="fa fa-exclamation-circle"/> <t t-esc='ps'/>
|
||||
</t>
|
||||
</t>
|
||||
<t t-if="splitted">
|
||||
<p>This reservation is part of splitted reservation. You can check it in the corresponding Folio.</p>
|
||||
</t>
|
||||
<div class="col-sm-6 bg-gray-lighter">
|
||||
<i class="fa fa-hotel fa-2_5x fa-pull-left mt-5 text-gray-dark"/>
|
||||
<header class="mt-5"><t t-esc="room_type_name"/></header>
|
||||
|
||||
<p><t t-esc="board_service_name"/></p>
|
||||
|
||||
<span class="circle pull-left"><t t-esc="price_room_services_set" t-widget="monetary"/>€</span>
|
||||
<p>Adults: <t t-esc="adults"/></p>
|
||||
<p class="children">Children: <t t-esc="children"/></p>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="HotelCalendar.TooltipReservation.Sale">
|
||||
<div class="row row-eq-height mt-3">
|
||||
<div class="col-sm-3 bg-primary pb-10">
|
||||
<!-- FIXME: HARD CURRENCY -->
|
||||
<p>Folio Pending</p>
|
||||
<h3><t t-esc="amount_total" t-widget="monetary"/> €</h3>
|
||||
</div>
|
||||
<div class="col-sm-3 bg-gray-lighter pb-10">
|
||||
<!-- FIXME: HARD CURRENCY -->
|
||||
<h3><t t-esc="amount_paid" t-widget="monetary"/> €</h3>
|
||||
<p>Total Paid</p>
|
||||
<div class="col-sm-6 bg-gray-light pb-3 pr-0 diagonal">
|
||||
<div class="on-top">
|
||||
<div class="pull-left">
|
||||
<p>Folio Pending</p>
|
||||
<t t-if="pending_amount.length > '6'">
|
||||
<h3 t-attf-style="font-size:calc(22px - #{pending_amount.length}px)"><t t-esc="pending_amount" t-widget="monetary"/>€</h3> <!-- FIXME: HARD CURRENCY -->
|
||||
</t>
|
||||
<t t-else="">
|
||||
<h3><t t-esc="pending_amount" t-widget="monetary"/>€</h3> <!-- FIXME: HARD CURRENCY -->
|
||||
</t>
|
||||
</div>
|
||||
<div class="pull-right-custom">
|
||||
<t t-if="invoices_paid.length > '6'">
|
||||
<h3 t-attf-style="font-size:calc(22px - #{invoices_paid.length}px)"><t t-esc="invoices_paid" t-widget="monetary"/>€</h3> <!-- FIXME: HARD CURRENCY -->
|
||||
</t>
|
||||
<t t-else="">
|
||||
<h3><t t-esc="invoices_paid" t-widget="monetary"/>€</h3> <!-- FIXME: HARD CURRENCY -->
|
||||
</t>
|
||||
<p>Total Paid</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 bg-gray-light">
|
||||
<t t-if="channel_type == 'web'">
|
||||
<t t-call="HotelCalendar.TooltipReservation.Channel.ota"/>
|
||||
@@ -175,37 +168,67 @@
|
||||
|
||||
<t t-name="HotelCalendar.TooltipReservation.Dates">
|
||||
<div class="row row-eq-height mt-3">
|
||||
<div class="col-sm-6 bg-gray-light py-5">
|
||||
<i class="fa fa-sign-in fa-2x fa-pull-left"/>
|
||||
<h3><t t-esc="checkin"/></h3>
|
||||
<p><t t-esc="checkin_day_of_week"/> <t t-esc="arrival_hour"/></p>
|
||||
<div class="col-sm-12 triangle-right">
|
||||
<div class="col-sm-6 px-0">
|
||||
<i class="fa fa-sign-in fa-2x fa-pull-left pl-5 py-5"/>
|
||||
<h3><t t-esc="checkin"/></h3>
|
||||
<p><t t-esc="checkin_day_of_week"/> <t t-esc="arrival_hour"/></p>
|
||||
</div>
|
||||
<div class="col-sm-6 text-gray-dark">
|
||||
<i class="fa fa-sign-out fa-2x fa-pull-left pl-5 py-5"/>
|
||||
<h3><t t-esc="checkout"/></h3>
|
||||
<p><t t-esc="checkout_day_of_week"/> <t t-esc="departure_hour"/></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 bg-gray-lighter d-sm-2 py-5">
|
||||
<i class="fa fa-sign-out fa-2x fa-pull-left"/>
|
||||
<h3><t t-esc="checkout"/></h3>
|
||||
<p><t t-esc="checkout_day_of_week"/> <t t-esc="departure_hour"/></p>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="HotelCalendar.TooltipReservation.Footer">
|
||||
<div class="row row-eq-height mt-10">
|
||||
<div class="col-sm-4 btn_popover_open_folio pr-0">
|
||||
<i class="fa fa-file-text-o fa-2x fa-pull-left" role="button"
|
||||
title="View Folio Details"> <span class="fa-text-inside"><t t-esc="folio_name"/></span></i>
|
||||
</div>
|
||||
<div class="col-sm-2 btn_popover_open_reservation">
|
||||
<span class="fa fa-suitcase fa-2x" role="button"
|
||||
title="View Reservation Details" />
|
||||
</div>
|
||||
<div class="col-sm-2 btn_popover_open_checkin">
|
||||
<span class="fa fa-user-plus fa-2x" role="button"
|
||||
title="Checkin" />
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<span class="fa fa-envelope fa-2x" role="button"
|
||||
title="Send Reservation Email" />
|
||||
</div>
|
||||
<div class="col-sm-2 btn_popover_open_payment">
|
||||
<span class="fa fa-money fa-2x" role="button"
|
||||
title="Folio Payments" />
|
||||
</div>
|
||||
<t t-if="reservation_type =='normal'">
|
||||
<div class="col-sm-2 btn_popover_open_invoice">
|
||||
<span class="fa fa-pencil-square-o fa-2x" role="button"
|
||||
title="Invoice Folio" />
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
<div class="row row-eq-height mt-10">
|
||||
<div class="col-sm-12">
|
||||
<t t-if="services">
|
||||
<t t-foreach='services' t-as='ps'>
|
||||
<i class="fa fa-exclamation-circle"/> <t t-esc='ps'/>
|
||||
</t>
|
||||
</t>
|
||||
<t t-if="splitted">
|
||||
<p><i class="fa fa-exclamation-circle"/>This reservation is part of splitted reservation.</p>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="HotelCalendar.TooltipReservation.normal">
|
||||
<div class="container">
|
||||
<div class="row row-eq-height">
|
||||
<div class="col-sm-6 bg-gray-light">
|
||||
<i class="fa fa-user-circle fa-2x fa-pull-left"/>
|
||||
<header><t t-esc="name"/></header>
|
||||
<p><t t-esc="phone"/></p>
|
||||
<p><t t-esc="email"/></p>
|
||||
</div>
|
||||
<div class="col-sm-6 bg-gray-lighter">
|
||||
<i class="fa fa-hotel fa-2x fa-pull-left"/>
|
||||
<h3 class="pull-right mt-3"><t t-esc="amount_total" t-widget="monetary"/>€</h3>
|
||||
<header><t t-esc="room_type_name"/></header>
|
||||
|
||||
<p>Board Service: <t t-esc="board_service_name"/></p>
|
||||
<p>Adults: <t t-esc="adults"/> - Children: <t t-esc="children"/></p>
|
||||
</div>
|
||||
</div>
|
||||
<t t-call="HotelCalendar.TooltipReservation.Customer"/>
|
||||
<t t-call="HotelCalendar.TooltipReservation.Sale"/>
|
||||
<t t-call="HotelCalendar.TooltipReservation.Dates"/>
|
||||
<t t-call="HotelCalendar.TooltipReservation.Footer"/>
|
||||
@@ -216,20 +239,20 @@
|
||||
<div class="container">
|
||||
<div class="row row-eq-height">
|
||||
<div class="col-sm-6 bg-danger">
|
||||
<i class="fa fa-black-tie fa-2x fa-pull-left"/>
|
||||
<i class="fa fa-black-tie fa-2x fa-pull-left mt-5"/>
|
||||
<header><t t-esc="name"/></header>
|
||||
<p><t t-esc="phone"/></p>
|
||||
<p><t t-esc="email"/></p>
|
||||
<p class="email"><t t-esc="email"/></p>
|
||||
</div>
|
||||
<div class="col-sm-6 bg-gray-lighter">
|
||||
<i class="fa fa-hotel fa-2x fa-pull-left"/>
|
||||
<header><t t-esc="room_type_name"/></header>
|
||||
<i class="fa fa-hotel fa-2_5x fa-pull-left mt-5"/>
|
||||
<header class="mt-5"><t t-esc="room_type_name"/></header>
|
||||
<p><t t-esc="board_service_name"/></p>
|
||||
|
||||
<p>Board Service: <t t-esc="board_service_name"/></p>
|
||||
<p>Adults: <t t-esc="adults"/> - Children: <t t-esc="children"/></p>
|
||||
<p>Adults: <t t-esc="adults"/></p>
|
||||
<p class="children">Children: <t t-esc="children"/></p>
|
||||
</div>
|
||||
</div>
|
||||
<t t-call="HotelCalendar.TooltipReservation.Sale"/>
|
||||
<t t-call="HotelCalendar.TooltipReservation.Dates"/>
|
||||
<t t-call="HotelCalendar.TooltipReservation.Footer"/>
|
||||
</div>
|
||||
@@ -251,8 +274,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<t t-call="HotelCalendar.TooltipReservation.Dates"/>
|
||||
<div class="row row-eq-height mt-10">
|
||||
<div class="col-sm-2 btn_popover_open_folio">
|
||||
<div class="row row-eq-height my-10">
|
||||
<div class="col-sm-4 btn_popover_open_folio">
|
||||
<i class="fa fa-file-text-o fa-2x fa-pull-left" role="button"
|
||||
title="View Folio Details"> <span class="fa-text-inside"><t t-esc="folio_name"/></span></i>
|
||||
</div>
|
||||
@@ -260,10 +283,6 @@
|
||||
<span class="fa fa-suitcase fa-2x" role="button"
|
||||
title="View Reservation Details" />
|
||||
</div>
|
||||
<div class="col-sm-2 btn_popover_close">
|
||||
<span class="fa fa-window-close fa-2x" role="button"
|
||||
title="Close" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
285
hotel_channel_connector_wubook/tests/README.rst
Normal file
285
hotel_channel_connector_wubook/tests/README.rst
Normal file
@@ -0,0 +1,285 @@
|
||||
==============================
|
||||
HOTEL CHANNEL CONNECTOR WUBOOK
|
||||
==============================
|
||||
|
||||
The following list define the test to be covered by this module.
|
||||
|
||||
Knowledge Base
|
||||
==============
|
||||
- WuBook uses a default Restrictions Plan with ``rpid=0`` for the Online Reception restrictions.
|
||||
- WuBook uses a default Parity Rate Plan with ``pid=0`` for the Online Reception prices.
|
||||
- You can not define a Parity Restriction Plan for Online Receptions.
|
||||
- You can define a Parity Rate Plan for Online Receptions.
|
||||
- Handling Rooms: https://tdocs.wubook.net/wired/rooms.html
|
||||
- Wired: updating availability https://tdocs.wubook.net/wired/avail.html
|
||||
|
||||
Scenario 1 (TS100)
|
||||
==================
|
||||
:Prerequisites: You have a new WuBook account ready to use **without** Rooms,
|
||||
neither Rate plans or Restrictions plans.
|
||||
|
||||
Test TC101
|
||||
----------
|
||||
|
||||
:Summary: **Install** the `Hotel Channel Connector Wubook` module and
|
||||
**create** a `Hotel Channel Backend` will bind WuBook as the hotel channel manager.
|
||||
|
||||
:Procedure:
|
||||
1. Install the ``hotel_channel_connector_wubook`` module.
|
||||
2. Create a new Hotel Channel Backend with your WuBook Account Credentials.
|
||||
3. Generate a new Channel Service Security Token.
|
||||
|
||||
:Result:
|
||||
- You can Import OTA's Info.
|
||||
- You can Export Availability, Restrictions and Pricelists.
|
||||
- You can bind Rooms, Rate Plans and Restriction Plans.
|
||||
|
||||
:Remarks: You can not Import Rooms, neither Availability, Restriction Plans and Restriction Values,
|
||||
Pricelist Plans and Pricelist Values because it is a new WuBook Account.
|
||||
|
||||
:Status: Test Passed.
|
||||
|
||||
Test TC102
|
||||
----------
|
||||
|
||||
:Summary: Bind **Room Types** to the Hotel Channel Connector Backend.
|
||||
|
||||
:Requirement: TC101
|
||||
|
||||
:Procedure: Add the Hotel Channel Connector Backend to the Room Type.
|
||||
|
||||
:Result:
|
||||
- The Room Type is created in WuBook.
|
||||
- You can modify the following fields: ``name``, ``capacity``, ``price``, ``availability``,
|
||||
``scode``, ``dboard``, ``rtype``.
|
||||
|
||||
:Remarks: Creating a Room Type in WuBook will `make available`
|
||||
a **default WuBook Restrictions Plan** named **WuBook Restrictions** with ``rpid=0`` and
|
||||
a **default WuBook Rate Plan** named **WuBook Parity** with ``pid=0``.
|
||||
|
||||
:Status: Test Passed.
|
||||
|
||||
Test TC103
|
||||
----------
|
||||
|
||||
:Summary: Bind **Restriction Plans** to the Hotel Channel Connector Backend.
|
||||
|
||||
:Requirement: TC101
|
||||
|
||||
:Procedure: Add the Hotel Channel Connector Backend to the Restriction Plan.
|
||||
|
||||
:Result:
|
||||
- The Restriction Plan is created in WuBook.
|
||||
- You can modify the following fields: ``name``.
|
||||
|
||||
:Remarks: Creating a Restriction Plan in WuBook will `create`
|
||||
a **new WuBook Restrictions Plan** with ``rpid!=0``.
|
||||
|
||||
:Status: Test Passed.
|
||||
|
||||
Test TC104
|
||||
----------
|
||||
|
||||
:Summary: Add **Restrictions**
|
||||
|
||||
:Requirement: TC101, TC102, TC103
|
||||
|
||||
:Procedure: Add Restriction Items into the Restriction Plan.
|
||||
|
||||
:Result: The Restriction Plan is updated in WuBook.
|
||||
|
||||
:Remarks: For this test you need Push Restrictions in the Hotel Channel Backends Export form.
|
||||
|
||||
:Status: Test Passed.
|
||||
|
||||
Test TC105
|
||||
----------
|
||||
|
||||
:Summary: Delete **Restrictions**
|
||||
|
||||
:Requirement: TC101, TC102, TC103
|
||||
|
||||
:Procedure: Delete a Restriction Items in Odoo.
|
||||
|
||||
:Result: The Restriction Plan is updated in WuBook.
|
||||
|
||||
:Remarks: For this test you need Push Restrictions in the Hotel Channel Backends Export form.
|
||||
|
||||
:Status: Test Failed.
|
||||
|
||||
:Reason: Restrictions remain in WuBook.
|
||||
|
||||
Test TC106
|
||||
----------
|
||||
|
||||
:Summary: Bind **Product Pricelist** to the Hotel Channel Connector Backend.
|
||||
|
||||
:Requirement: TC101
|
||||
|
||||
:Procedure: Add the Hotel Channel Connector Backend to the Product Pricelist.
|
||||
|
||||
:Result:
|
||||
- The Product Pricelist is created in WuBook.
|
||||
- You can modify the following fields: ``name``.
|
||||
|
||||
:Remarks: Creating a Product Pricelist in WuBook will `create` a
|
||||
**new WuBook Rate Plan** with ``pid!=0``.
|
||||
|
||||
:Status: Test Passed.
|
||||
|
||||
Test TC107
|
||||
----------
|
||||
|
||||
:Summary: Add Room Type **Price**
|
||||
|
||||
:Requirement: TC101, TC102, TC105
|
||||
|
||||
:Procedure: Add Room Type Unit Price into the Rate Plan.
|
||||
|
||||
:Result: The Rate Plan is updated in WuBook.
|
||||
|
||||
:Remarks: For this test use the Massive Changes Wizard.
|
||||
|
||||
:Status: Test Passed.
|
||||
|
||||
Test TC108
|
||||
----------
|
||||
|
||||
:Summary: Add **Availability** to the Hotel Room Type.
|
||||
|
||||
:Requirement: TC101, TC102, T103
|
||||
|
||||
:Procedure: Add the availability to the Room Type using a Hotel Channel Connector Backend.
|
||||
|
||||
:Result: The Availability is created in WuBook.
|
||||
|
||||
:Remarks: The availability is updated in WuBook after Push Availability.
|
||||
|
||||
:Status: Test Passed.
|
||||
|
||||
Test TC109
|
||||
----------
|
||||
|
||||
:Summary: Delete **Availability** from the Hotel Room Type.
|
||||
|
||||
:Requirement: TC101, TC102, T103
|
||||
|
||||
:Procedure: Delete Availability Items in Odoo.
|
||||
|
||||
:Result: The Restriction Plan is updated in WuBook.
|
||||
|
||||
:Remarks: The availability is updated in WuBook after Push Availability.
|
||||
|
||||
:Status: Test Failed.
|
||||
|
||||
Test TC110
|
||||
----------
|
||||
|
||||
:Summary: Bind the **Restriction Plan** in Odoo to the Hotel Channel Connector Backend
|
||||
using ``ID on Channel=0`` will start its **parity** with the default Restriction Plan **in WuBook**.
|
||||
|
||||
:Requirement: TC101
|
||||
|
||||
:Procedure: Add the Hotel Channel Connector Backend to the Restriction Plan using **``ID on Channel=0``**.
|
||||
|
||||
:Result: The Odoo Restriction Plan will be in parity with the
|
||||
default WuBook Restrictions Plan with ``rpid=0`` named **WuBook Restrictions**.
|
||||
|
||||
:Status: Test Passed.
|
||||
|
||||
Test TC111
|
||||
----------
|
||||
|
||||
:Summary: Bind the **Product Pricelist** in Odoo to the Hotel Channel Connector Backend
|
||||
will start its **parity** with the default Price Plan **in WuBook**.
|
||||
|
||||
:Requirement: TC101
|
||||
|
||||
:Procedure: Add the Hotel Channel Connector Backend to the Product Pricelis using **``ID on Channel=0``**.
|
||||
|
||||
:Result: The Product Pricelist created in WuBook is in parity with the
|
||||
default WuBook Restrictions Plan with ``rpid=0``.
|
||||
|
||||
:Status: Unknown.
|
||||
|
||||
Test TC112
|
||||
----------
|
||||
|
||||
:Summary: Update any **binded field** in a Room Type will automatically update the corresponding field in **WuBook**.
|
||||
|
||||
:Requirement: TC101, TC102
|
||||
|
||||
:Procedure: Edit a Room Type and modify the ``name``.
|
||||
|
||||
:Result: The name in WuBook is also updated.
|
||||
|
||||
:Status: Failed.
|
||||
|
||||
:Reason: Some fields (``name``, ``list_price``) are updated `only` if the Hotel Channel Connector Binding is updated.
|
||||
|
||||
|
||||
Scenario 2 (TS002)
|
||||
==================
|
||||
:Prerequisites: `Scenario 1 (TS100)`_ Tests passed.
|
||||
|
||||
:Summary: This tests review the basic reservation management.
|
||||
|
||||
Test TC201
|
||||
----------
|
||||
|
||||
:Summary: **Create** a Reservation **decreases** the Room Type Availability in one in the corresponding Plan in Wubook.
|
||||
|
||||
:Procedure: Create a reservation with a room type binded to the Hotel Channel Connector Backend.
|
||||
|
||||
:Result: The availability is decreased by one.
|
||||
|
||||
:Status: Test Failed.
|
||||
|
||||
:Reason: The availability remains the same.
|
||||
|
||||
Test TC202
|
||||
----------
|
||||
|
||||
:Summary: **Cancel** a Reservation **increases** the Room Type Availability in one in the corresponding Plan in Wubook.
|
||||
|
||||
:Procedure: Cancel a reservation with a room type binded to the Hotel Channel Connector Backend.
|
||||
|
||||
:Result: The availability is increased by one.
|
||||
|
||||
:Status: Not done yet.
|
||||
|
||||
Test TC203
|
||||
----------
|
||||
|
||||
:Summary: **Change** the Room Type in a Reservation **modifies** the Room Type Availability
|
||||
in the corresponding Plan in Wubook.
|
||||
|
||||
:Procedure: Change the Room Type in a reservation to any room type binded to the Hotel Channel Connector Backend.
|
||||
|
||||
:Result: The availability is modified according to the change done.
|
||||
|
||||
:Status: Not done yet.
|
||||
|
||||
Test TC204
|
||||
----------
|
||||
|
||||
:Summary: **Change** Checkin/Checkout dates in a Reservation **modifies** the Room Type Availability
|
||||
in the corresponding Plan in Wubook.
|
||||
|
||||
:Procedure: Change the Checkin/Checkout in a reservation with a room type binded to the Hotel Channel Connector Backend.
|
||||
|
||||
:Result: The availability is modified according to the change done.
|
||||
|
||||
:Status: Not done yet.
|
||||
|
||||
Test TC205
|
||||
----------
|
||||
|
||||
:Summary: **Reselling** state in a Reservation **increases** the Room Type Availability
|
||||
in the corresponding Plan in Wubook.
|
||||
|
||||
:Procedure: Mark a reservation as `reselling` with a room type binded to the Hotel Channel Connector Backend.
|
||||
|
||||
:Result: The availability is increased by one.
|
||||
|
||||
:Status: Not done yet.
|
||||
@@ -1,2 +1,3 @@
|
||||
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import test_channel_hotel_room_type_adapter_model
|
||||
@@ -22,13 +22,12 @@
|
||||
##############################################################################
|
||||
from datetime import timedelta
|
||||
from odoo import api
|
||||
from odoo.addons.hotel import date_utils
|
||||
from odoo.addons.hotel.tests.common import TestHotel
|
||||
from odoo.addons.hotel_wubook_proto.wubook import (
|
||||
DEFAULT_WUBOOK_DATE_FORMAT,
|
||||
DEFAULT_WUBOOK_TIME_FORMAT,
|
||||
WUBOOK_STATUS_CONFIRMED,
|
||||
WUBOOK_STATUS_CANCELLED)
|
||||
# from odoo.addons.hotel_wubook_proto.wubook import (
|
||||
# DEFAULT_WUBOOK_DATE_FORMAT,
|
||||
# DEFAULT_WUBOOK_TIME_FORMAT,
|
||||
# WUBOOK_STATUS_CONFIRMED,
|
||||
# WUBOOK_STATUS_CANCELLED)
|
||||
from random import randint
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -38,7 +37,7 @@ class TestHotelWubook(TestHotel):
|
||||
|
||||
@classmethod
|
||||
def _init_mock_hotel(cls):
|
||||
super(TestHotelWubook, cls)._init_mock_hotel()
|
||||
super()._init_mock_hotel()
|
||||
|
||||
@api.multi
|
||||
def wubook_ommit(self, *args, **kwargs):
|
||||
@@ -49,262 +48,275 @@ class TestHotelWubook(TestHotel):
|
||||
wid=False, dfrom=False, dto=False):
|
||||
_logger.info("ISSUE CREATED:\n\t- %s\n\t--- %s", section, message)
|
||||
|
||||
cls.env['wubook']._patch_method('create_channel_connector_issue',
|
||||
wubook_create_channel_connector_issue)
|
||||
cls.env['wubook']._patch_method('is_valid_account', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('initialize', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('push_activation', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('init_connection', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('close_connection', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('create_room', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('modify_room', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('delete_room', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('import_rooms', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('fetch_rooms_values', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('update_availability', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('corporate_fetch', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('create_reservation', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('cancel_reservation', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('fetch_new_bookings', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('fetch_booking', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('mark_bookings', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('create_plan', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('delete_plan', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('update_plan_name', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('update_plan_prices', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('update_plan_periods', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('import_pricing_plans', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('fetch_plan_prices', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('fetch_all_plan_prices', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('import_restriction_plans',
|
||||
wubook_ommit)
|
||||
cls.env['wubook']._patch_method('fetch_rplan_restrictions',
|
||||
wubook_ommit)
|
||||
cls.env['wubook']._patch_method('update_rplan_values', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('create_rplan', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('rename_rplan', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('delete_rplan', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('import_channels_info', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('push_changes', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('push_availability', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('push_priceplans', wubook_ommit)
|
||||
cls.env['wubook']._patch_method('push_restrictions', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('create_channel_connector_issue',
|
||||
# wubook_create_channel_connector_issue)
|
||||
# cls.env['wubook']._patch_method('is_valid_account', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('initialize', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('push_activation', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('init_connection', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('close_connection', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('create_room', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('modify_room', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('delete_room', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('import_rooms', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('fetch_rooms_values', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('update_availability', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('corporate_fetch', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('create_reservation', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('cancel_reservation', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('fetch_new_bookings', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('fetch_booking', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('mark_bookings', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('create_plan', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('delete_plan', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('update_plan_name', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('update_plan_prices', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('update_plan_periods', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('import_pricing_plans', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('fetch_plan_prices', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('fetch_all_plan_prices', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('import_restriction_plans',
|
||||
# wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('fetch_rplan_restrictions',
|
||||
# wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('update_rplan_values', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('create_rplan', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('rename_rplan', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('delete_rplan', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('import_channels_info', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('push_changes', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('push_availability', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('push_priceplans', wubook_ommit)
|
||||
# cls.env['wubook']._patch_method('push_restrictions', wubook_ommit)
|
||||
|
||||
def create_wubook_booking(self, creator, checkin, partner, rinfo,
|
||||
channel=0, notes=''):
|
||||
rcode = randint(100000, 999999)
|
||||
crcode = randint(100000, 999999)
|
||||
brate = randint(100000, 999999)
|
||||
id_woodoo = randint(100000, 999999)
|
||||
# def create_wubook_booking(self, creator, checkin, partner, rinfo,
|
||||
# channel=0, notes=''):
|
||||
# rcode = randint(100000, 999999)
|
||||
# crcode = randint(100000, 999999)
|
||||
# brate = randint(100000, 999999)
|
||||
# id_woodoo = randint(100000, 999999)
|
||||
#
|
||||
# if not partner.email or partner.email == '':
|
||||
# self.raiseException("Partner doesn't have a mail")
|
||||
#
|
||||
# now_utc_dt = date_utils.now()
|
||||
# now_dt = date_utils.dt_as_timezone(now_utc_dt, self.tz_hotel)
|
||||
# checkin_utc_dt = date_utils.get_datetime(checkin)
|
||||
# checkin_dt = date_utils.dt_as_timezone(checkin_utc_dt, self.tz_hotel)
|
||||
# numdays = 0
|
||||
# for k_room, v_room in rinfo.iteritems():
|
||||
# numdays = max(len(v_room['dayprices']), numdays)
|
||||
# checkout_utc_dt = checkin_utc_dt + timedelta(days=numdays)
|
||||
# checkout_dt = date_utils.dt_as_timezone(checkout_utc_dt, self.tz_hotel)
|
||||
# date_diff = date_utils.date_diff(checkin_utc_dt, checkout_utc_dt,
|
||||
# hours=False)
|
||||
#
|
||||
# # Generate Day Prices
|
||||
# dayprices = {}
|
||||
# total_amount = 0.0
|
||||
# for k_room, v_room in rinfo.iteritems():
|
||||
# for price in v_room['dayprices']:
|
||||
# dayprices.setdefault(k_room, []).append(price)
|
||||
# total_amount += price
|
||||
# # Generate Values
|
||||
# rooms = []
|
||||
# rooms_occu = []
|
||||
# booked_rooms = []
|
||||
# room_type_obj = self.env['hotel.room.type']
|
||||
# max_persons = 0
|
||||
# for k_room, v_room in rinfo.iteritems():
|
||||
# room_type = room_type_obj.search([
|
||||
# ('wrid', '=', k_room)
|
||||
# ], limit=1)
|
||||
# # Generate Rooms
|
||||
# for price in range(0, len(v_room['occupancy'])):
|
||||
# rooms.append(k_room)
|
||||
# # Generate Rooms Occupancies
|
||||
# for val in v_room['occupancy']:
|
||||
# # Generate Rooms Occupancies
|
||||
# rooms_occu.append({
|
||||
# 'id': k_room,
|
||||
# 'occupancy': val,
|
||||
# })
|
||||
# # Generate Booked Rooms
|
||||
# roomdays = []
|
||||
# for k_price, v_price in enumerate(v_room['dayprices']):
|
||||
# ndate = checkin_dt + timedelta(days=k_price)
|
||||
# roomdays.append({
|
||||
# 'ancillary': {},
|
||||
# 'rate_id': 3,
|
||||
# 'price': v_price,create_channel_connector_issue
|
||||
# 'day': ndate.strftime(DEFAULT_WUBOOK_DATE_FORMAT)
|
||||
# })
|
||||
# booked_rooms.append({
|
||||
# 'ancillary': {
|
||||
# 'channel_room_id': 1,
|
||||
# 'channel_room_name': room_type.name,
|
||||
# 'addons': [],
|
||||
# 'guests': val
|
||||
# },
|
||||
# 'room_id': k_room,
|
||||
# 'roomdays': roomdays
|
||||
# })
|
||||
# if val > max_persons:
|
||||
# max_persons = val
|
||||
#
|
||||
# return {
|
||||
# 'id_channel': channel,
|
||||
# 'special_offer': '',
|
||||
# 'reservation_code': rcode,
|
||||
# 'dayprices': dayprices,
|
||||
# 'arrival_hour': checkin_dt.strftime(DEFAULT_WUBOOK_TIME_FORMAT),
|
||||
# 'booked_rate': brate,
|
||||
# 'rooms': ','.join(map(str, rooms)),
|
||||
# 'customer_mail': partner.email,
|
||||
# 'customer_country': 'ES',
|
||||
# 'children': 0,
|
||||
# 'payment_gateway_fee': '',
|
||||
# 'modified_reservations': [],
|
||||
# 'customer_surname': ' '.join(partner.name.split(' ')[1:]),
|
||||
# 'date_departure': checkout_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
|
||||
# 'amount_reason': '',
|
||||
# 'customer_city': partner.city,
|
||||
# 'opportunities': 0,
|
||||
# 'date_received': now_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
|
||||
# 'rooms_occupancies': rooms_occu,
|
||||
# 'sessionSeed': '',
|
||||
# 'booked_rooms': booked_rooms,
|
||||
# 'customer_name': partner.name.split(' ')[0],
|
||||
# 'date_arrival': checkin_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
|
||||
# 'status': WUBOOK_STATUS_CONFIRMED,
|
||||
# 'was_modified': 0,
|
||||
# 'channel_reservation_code': crcode,
|
||||
# 'men': max_persons,
|
||||
# 'orig_amount': total_amount,
|
||||
# 'customer_phone': partner.mobile or partner.phone or '',
|
||||
# 'customer_notes': notes,
|
||||
# 'customer_address': partner.street,
|
||||
# 'device': -1,
|
||||
# 'addons_list': [],
|
||||
# 'status_reason': '',
|
||||
# 'roomnight': date_diff-1,
|
||||
# 'boards': '',
|
||||
# 'customer_language': 32,
|
||||
# 'fount': '',
|
||||
# 'channel_data': {},
|
||||
# 'room_opportunities': 0,
|
||||
# 'customer_zip': partner.zip,
|
||||
# 'amount': total_amount,
|
||||
# 'id_woodoo': id_woodoo,
|
||||
# 'cc_info': 1,
|
||||
# 'customer_language_iso': 'es'
|
||||
# }
|
||||
|
||||
if not partner.email or partner.email == '':
|
||||
self.raiseException("Partner doesn't have a mail")
|
||||
# def create_wubook_rooms_values(self, rooms, values):
|
||||
# json_data = {}
|
||||
# _logger.info("=== PASA AAA")
|
||||
# _logger.info(values)
|
||||
# for room in rooms:
|
||||
# for cvalue in values:
|
||||
# json_data.setdefault(room.wrid, []).append({
|
||||
# 'closed_arrival': cvalue['closed_arrival'],
|
||||
# 'booked': cvalue['booked'],
|
||||
# 'max_stay_arrival': cvalue['max_stay_arrival'],
|
||||
# 'max_stay': cvalue['max_stay'],
|
||||
# 'price': cvalue['price'],
|
||||
# 'min_stay': cvalue['min_stay'],
|
||||
# 'closed_departure': cvalue['closed_departure'],
|
||||
# 'avail': cvalue['avail'],
|
||||
# 'closed': cvalue['closed'],
|
||||
# 'min_stay_arrival': cvalue['min_stay_arrival'],
|
||||
# 'no_ota': cvalue['no_ota'],
|
||||
# })
|
||||
# return json_data
|
||||
|
||||
now_utc_dt = date_utils.now()
|
||||
now_dt = date_utils.dt_as_timezone(now_utc_dt, self.tz_hotel)
|
||||
checkin_utc_dt = date_utils.get_datetime(checkin)
|
||||
checkin_dt = date_utils.dt_as_timezone(checkin_utc_dt, self.tz_hotel)
|
||||
numdays = 0
|
||||
for k_room, v_room in rinfo.iteritems():
|
||||
numdays = max(len(v_room['dayprices']), numdays)
|
||||
checkout_utc_dt = checkin_utc_dt + timedelta(days=numdays)
|
||||
checkout_dt = date_utils.dt_as_timezone(checkout_utc_dt, self.tz_hotel)
|
||||
date_diff = date_utils.date_diff(checkin_utc_dt, checkout_utc_dt,
|
||||
hours=False)
|
||||
|
||||
# Generate Day Prices
|
||||
dayprices = {}
|
||||
total_amount = 0.0
|
||||
for k_room, v_room in rinfo.iteritems():
|
||||
for price in v_room['dayprices']:
|
||||
dayprices.setdefault(k_room, []).append(price)
|
||||
total_amount += price
|
||||
# Generate Values
|
||||
rooms = []
|
||||
rooms_occu = []
|
||||
booked_rooms = []
|
||||
room_type_obj = self.env['hotel.room.type']
|
||||
max_persons = 0
|
||||
for k_room, v_room in rinfo.iteritems():
|
||||
room_type = room_type_obj.search([
|
||||
('wrid', '=', k_room)
|
||||
], limit=1)
|
||||
# Generate Rooms
|
||||
for price in range(0, len(v_room['occupancy'])):
|
||||
rooms.append(k_room)
|
||||
# Generate Rooms Occupancies
|
||||
for val in v_room['occupancy']:
|
||||
# Generate Rooms Occupancies
|
||||
rooms_occu.append({
|
||||
'id': k_room,
|
||||
'occupancy': val,
|
||||
})
|
||||
# Generate Booked Rooms
|
||||
roomdays = []
|
||||
for k_price, v_price in enumerate(v_room['dayprices']):
|
||||
ndate = checkin_dt + timedelta(days=k_price)
|
||||
roomdays.append({
|
||||
'ancillary': {},
|
||||
'rate_id': 3,
|
||||
'price': v_price,
|
||||
'day': ndate.strftime(DEFAULT_WUBOOK_DATE_FORMAT)
|
||||
})
|
||||
booked_rooms.append({
|
||||
'ancillary': {
|
||||
'channel_room_id': 1,
|
||||
'channel_room_name': room_type.name,
|
||||
'addons': [],
|
||||
'guests': val
|
||||
},
|
||||
'room_id': k_room,
|
||||
'roomdays': roomdays
|
||||
})
|
||||
if val > max_persons:
|
||||
max_persons = val
|
||||
|
||||
return {
|
||||
'id_channel': channel,
|
||||
'special_offer': '',
|
||||
'reservation_code': rcode,
|
||||
'dayprices': dayprices,
|
||||
'arrival_hour': checkin_dt.strftime(DEFAULT_WUBOOK_TIME_FORMAT),
|
||||
'booked_rate': brate,
|
||||
'rooms': ','.join(map(str, rooms)),
|
||||
'customer_mail': partner.email,
|
||||
'customer_country': 'ES',
|
||||
'children': 0,
|
||||
'payment_gateway_fee': '',
|
||||
'modified_reservations': [],
|
||||
'customer_surname': ' '.join(partner.name.split(' ')[1:]),
|
||||
'date_departure': checkout_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
|
||||
'amount_reason': '',
|
||||
'customer_city': partner.city,
|
||||
'opportunities': 0,
|
||||
'date_received': now_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
|
||||
'rooms_occupancies': rooms_occu,
|
||||
'sessionSeed': '',
|
||||
'booked_rooms': booked_rooms,
|
||||
'customer_name': partner.name.split(' ')[0],
|
||||
'date_arrival': checkin_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
|
||||
'status': WUBOOK_STATUS_CONFIRMED,
|
||||
'was_modified': 0,
|
||||
'channel_reservation_code': crcode,
|
||||
'men': max_persons,
|
||||
'orig_amount': total_amount,
|
||||
'customer_phone': partner.mobile or partner.phone or '',
|
||||
'customer_notes': notes,
|
||||
'customer_address': partner.street,
|
||||
'device': -1,
|
||||
'addons_list': [],
|
||||
'status_reason': '',
|
||||
'roomnight': date_diff-1,
|
||||
'boards': '',
|
||||
'customer_language': 32,
|
||||
'fount': '',
|
||||
'channel_data': {},
|
||||
'room_opportunities': 0,
|
||||
'customer_zip': partner.zip,
|
||||
'amount': total_amount,
|
||||
'id_woodoo': id_woodoo,
|
||||
'cc_info': 1,
|
||||
'customer_language_iso': 'es'
|
||||
}
|
||||
|
||||
def create_wubook_rooms_values(self, rooms, values):
|
||||
json_data = {}
|
||||
_logger.info("=== PASA AAA")
|
||||
_logger.info(values)
|
||||
for room in rooms:
|
||||
for cvalue in values:
|
||||
json_data.setdefault(room.wrid, []).append({
|
||||
'closed_arrival': cvalue['closed_arrival'],
|
||||
'booked': cvalue['booked'],
|
||||
'max_stay_arrival': cvalue['max_stay_arrival'],
|
||||
'max_stay': cvalue['max_stay'],
|
||||
'price': cvalue['price'],
|
||||
'min_stay': cvalue['min_stay'],
|
||||
'closed_departure': cvalue['closed_departure'],
|
||||
'avail': cvalue['avail'],
|
||||
'closed': cvalue['closed'],
|
||||
'min_stay_arrival': cvalue['min_stay_arrival'],
|
||||
'no_ota': cvalue['no_ota'],
|
||||
})
|
||||
return json_data
|
||||
|
||||
def cancel_booking(self, wbooking):
|
||||
wbooking['status'] = WUBOOK_STATUS_CANCELLED
|
||||
return wbooking
|
||||
# def cancel_booking(self, wbooking):
|
||||
# wbooking['status'] = WUBOOK_STATUS_CANCELLED
|
||||
# return wbooking
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestHotelWubook, cls).setUpClass()
|
||||
super().setUpClass()
|
||||
|
||||
# Update Test Virtual Rooms
|
||||
cls.hotel_room_type_budget.write({
|
||||
'wcapacity': 1,
|
||||
'wrid': 3000,
|
||||
'wscode': 'T001',
|
||||
})
|
||||
cls.hotel_room_type_special.write({
|
||||
'wcapacity': 2,
|
||||
'wrid': 3001,
|
||||
'wscode': 'T002',
|
||||
cls.manager_hotel_demo = cls.env.ref('base.user_demo')
|
||||
cls.manager_hotel_demo.groups_id += cls.env.ref('hotel.group_hotel_manager')
|
||||
|
||||
# Create a fake channel connector with WuBook
|
||||
cls.channel_connector_wubook = cls.env['channel.backend'].create({
|
||||
'version': '1.1',
|
||||
'lcode': 123456789,
|
||||
'pkey': 'YourProviderKey',
|
||||
'server': 'https://wired.wubook.net/xrws/'
|
||||
})
|
||||
|
||||
# Update Hotel Test Room Type Records
|
||||
# cls.room_type_0.write({
|
||||
# 'ota_capacity': 2,
|
||||
# 'wrid': 3000,
|
||||
# 'shortname': 'T000',
|
||||
# # }) # formerly named hotel_room_type_budget
|
||||
# cls.room_type_0.write({
|
||||
# 'ota_capacity': 1,
|
||||
# 'wrid': 3001,
|
||||
# 'shortname': 'T001',
|
||||
# }) # formerly named hotel_room_type_budget
|
||||
# cls.room_type_0.write({
|
||||
# 'ota_capacity': 2,
|
||||
# 'wrid': 3002,
|
||||
# 'shortname': 'T002',
|
||||
# }) # formerly named hotel_room_type_special
|
||||
|
||||
# Update Restriction
|
||||
room_type_restr_obj = cls.env['hotel.room.type.restriction']
|
||||
default_restriction = room_type_restr_obj.search([
|
||||
('wpid', '=', '0')
|
||||
], limit=1)
|
||||
if default_restriction:
|
||||
cls.restriction_default_id = default_restriction.id
|
||||
else:
|
||||
cls.restriction_1.write({
|
||||
'wpid': '0'
|
||||
})
|
||||
cls.restriction_default_id = cls.restriction_1.id
|
||||
# room_type_restr_obj = cls.env['hotel.room.type.restriction']
|
||||
# default_restriction = room_type_restr_obj.search([
|
||||
# ('wpid', '=', '0')
|
||||
# ], limit=1)
|
||||
# if default_restriction:
|
||||
# cls.restriction_default_id = default_restriction.id
|
||||
# else:
|
||||
# cls.restriction_1.write({
|
||||
# 'wpid': '0'
|
||||
# })
|
||||
# cls.restriction_default_id = cls.restriction_1.id
|
||||
|
||||
# Create Wubook Channel Info
|
||||
|
||||
# Create Some Wubook Info
|
||||
cls.wubook_channel_test = cls.env['wubook.channel.info'].create({
|
||||
'wid': 1,
|
||||
'name': 'Channel Test'
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
# Remove mocks
|
||||
cls.env['wubook']._revert_method('create_channel_connector_issue')
|
||||
cls.env['wubook']._revert_method('is_valid_account')
|
||||
cls.env['wubook']._revert_method('initialize')
|
||||
cls.env['wubook']._revert_method('push_activation')
|
||||
cls.env['wubook']._revert_method('init_connection')
|
||||
cls.env['wubook']._revert_method('close_connection')
|
||||
cls.env['wubook']._revert_method('create_room')
|
||||
cls.env['wubook']._revert_method('modify_room')
|
||||
cls.env['wubook']._revert_method('delete_room')
|
||||
cls.env['wubook']._revert_method('import_rooms')
|
||||
cls.env['wubook']._revert_method('fetch_rooms_values')
|
||||
cls.env['wubook']._revert_method('update_availability')
|
||||
cls.env['wubook']._revert_method('corporate_fetch')
|
||||
cls.env['wubook']._revert_method('create_reservation')
|
||||
cls.env['wubook']._revert_method('cancel_reservation')
|
||||
cls.env['wubook']._revert_method('fetch_new_bookings')
|
||||
cls.env['wubook']._revert_method('fetch_booking')
|
||||
cls.env['wubook']._revert_method('mark_bookings')
|
||||
cls.env['wubook']._revert_method('create_plan')
|
||||
cls.env['wubook']._revert_method('delete_plan')
|
||||
cls.env['wubook']._revert_method('update_plan_name')
|
||||
cls.env['wubook']._revert_method('update_plan_prices')
|
||||
cls.env['wubook']._revert_method('update_plan_periods')
|
||||
cls.env['wubook']._revert_method('import_pricing_plans')
|
||||
cls.env['wubook']._revert_method('fetch_plan_prices')
|
||||
cls.env['wubook']._revert_method('fetch_all_plan_prices')
|
||||
cls.env['wubook']._revert_method('import_restriction_plans')
|
||||
cls.env['wubook']._revert_method('fetch_rplan_restrictions')
|
||||
cls.env['wubook']._revert_method('update_rplan_values')
|
||||
cls.env['wubook']._revert_method('create_rplan')
|
||||
cls.env['wubook']._revert_method('rename_rplan')
|
||||
cls.env['wubook']._revert_method('delete_rplan')
|
||||
cls.env['wubook']._revert_method('import_channels_info')
|
||||
# cls.env['wubook']._revert_method('create_channel_connector_issue')
|
||||
# cls.env['wubook']._revert_method('is_valid_account')
|
||||
# cls.env['wubook']._revert_method('initialize')
|
||||
# cls.env['wubook']._revert_method('push_activation')
|
||||
# cls.env['wubook']._revert_method('init_connection')
|
||||
# cls.env['wubook']._revert_method('close_connection')
|
||||
# cls.env['wubook']._revert_method('create_room')
|
||||
# cls.env['wubook']._revert_method('modify_room')
|
||||
# cls.env['wubook']._revert_method('delete_room')
|
||||
# cls.env['wubook']._revert_method('import_rooms')
|
||||
# cls.env['wubook']._revert_method('fetch_rooms_values')
|
||||
# cls.env['wubook']._revert_method('update_availability')
|
||||
# cls.env['wubook']._revert_method('corporate_fetch')
|
||||
# cls.env['wubook']._revert_method('create_reservation')
|
||||
# cls.env['wubook']._revert_method('cancel_reservation')
|
||||
# cls.env['wubook']._revert_method('fetch_new_bookings')
|
||||
# cls.env['wubook']._revert_method('fetch_booking')
|
||||
# cls.env['wubook']._revert_method('mark_bookings')
|
||||
# cls.env['wubook']._revert_method('create_plan')
|
||||
# cls.env['wubook']._revert_method('delete_plan')
|
||||
# cls.env['wubook']._revert_method('update_plan_name')
|
||||
# cls.env['wubook']._revert_method('update_plan_prices')
|
||||
# cls.env['wubook']._revert_method('update_plan_periods')
|
||||
# cls.env['wubook']._revert_method('import_pricing_plans')
|
||||
# cls.env['wubook']._revert_method('fetch_plan_prices')
|
||||
# cls.env['wubook']._revert_method('fetch_all_plan_prices')
|
||||
# cls.env['wubook']._revert_method('import_restriction_plans')
|
||||
# cls.env['wubook']._revert_method('fetch_rplan_restrictions')
|
||||
# cls.env['wubook']._revert_method('update_rplan_values')
|
||||
# cls.env['wubook']._revert_method('create_rplan')
|
||||
# cls.env['wubook']._revert_method('rename_rplan')
|
||||
# cls.env['wubook']._revert_method('delete_rplan')
|
||||
# cls.env['wubook']._revert_method('import_channels_info')
|
||||
|
||||
super(TestHotelWubook, cls).tearDownClass()
|
||||
super().tearDownClass()
|
||||
@@ -0,0 +1,84 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
|
||||
# Alexandre Díaz <dev@redneboa.es>
|
||||
#
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from odoo.tools import (
|
||||
DEFAULT_SERVER_DATETIME_FORMAT,
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
from odoo.exceptions import AccessError
|
||||
from .common import TestHotelWubook
|
||||
|
||||
|
||||
class TestChannelRoomType(TestHotelWubook):
|
||||
|
||||
def test_create_room(self):
|
||||
return True
|
||||
|
||||
def test_fetch_rooms(self):
|
||||
return True
|
||||
|
||||
def test_modify_room(self):
|
||||
return True
|
||||
|
||||
def test_delete_room(self):
|
||||
return True
|
||||
|
||||
# def test_get_capacity(self):
|
||||
# self.assertEqual(self.room_type_0.wcapacity,
|
||||
# 1,
|
||||
# "Invalid wcapacity")
|
||||
|
||||
# def test_check_wcapacity(self):
|
||||
# with self.assertRaises(ValidationError):
|
||||
# self.room_type_0.sudo(self.user_hotel_manager).write({
|
||||
# 'wcapacity': 0
|
||||
# })
|
||||
|
||||
# def test_check_wscode(self):
|
||||
# with self.assertRaises(ValidationError):
|
||||
# self.room_type_0.sudo(self.user_hotel_manager).write({
|
||||
# 'wscode': 'abcdefg'
|
||||
# })
|
||||
|
||||
# def test_get_restrictions(self):
|
||||
# now_utc_dt = date_utils.now()
|
||||
# rests = self.hotel_room_type_budget.sudo(
|
||||
# self.user_hotel_manager).get_restrictions(
|
||||
# now_utc_dt.strftime(
|
||||
# DEFAULT_SERVER_DATE_FORMAT))
|
||||
# self.assertTrue(any(rests), "Restrictions not found")
|
||||
|
||||
# def test_import_rooms(self):
|
||||
# self.room_type_0.sudo(self.user_hotel_manager).import_rooms()
|
||||
|
||||
# def test_create(self):
|
||||
# room_type_obj = self.env['hotel.room.type']
|
||||
# room_type = room_type_obj.sudo(self.user_hotel_manager).create({
|
||||
# 'name': 'Budget Room',
|
||||
# 'virtual_code': '001',
|
||||
# 'list_price': 50,
|
||||
# 'wrid': 1234
|
||||
# })
|
||||
# room_type.unlink()
|
||||
|
||||
# def test_unlink(self):
|
||||
# with self.assertRaises(AccessError):
|
||||
# self.hotel_room_type_simple.sudo(self.manager_hotel_demo).unlink()
|
||||
@@ -1,73 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
|
||||
# Alexandre Díaz <dev@redneboa.es>
|
||||
#
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from datetime import timedelta
|
||||
from openerp.tools import (
|
||||
DEFAULT_SERVER_DATETIME_FORMAT,
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
from openerp.exceptions import ValidationError
|
||||
from odoo.addons.hotel import date_utils
|
||||
from .common import TestHotelWubook
|
||||
|
||||
|
||||
class TestHotelVirtualRoom(TestHotelWubook):
|
||||
|
||||
def test_get_capacity(self):
|
||||
self.assertEqual(self.hotel_room_type_budget.wcapacity,
|
||||
1,
|
||||
"Invalid wcapacity")
|
||||
|
||||
def test_check_wcapacity(self):
|
||||
with self.assertRaises(ValidationError):
|
||||
self.hotel_room_type_budget.sudo(self.user_hotel_manager).write({
|
||||
'wcapacity': 0
|
||||
})
|
||||
|
||||
def test_check_wscode(self):
|
||||
with self.assertRaises(ValidationError):
|
||||
self.hotel_room_type_budget.sudo(self.user_hotel_manager).write({
|
||||
'wscode': 'abcdefg'
|
||||
})
|
||||
|
||||
def test_get_restrictions(self):
|
||||
now_utc_dt = date_utils.now()
|
||||
rests = self.hotel_room_type_budget.sudo(
|
||||
self.user_hotel_manager).get_restrictions(
|
||||
now_utc_dt.strftime(
|
||||
DEFAULT_SERVER_DATE_FORMAT))
|
||||
self.assertTrue(any(rests), "Restrictions not found")
|
||||
|
||||
def test_import_rooms(self):
|
||||
self.hotel_room_type_budget.sudo(self.user_hotel_manager).import_rooms()
|
||||
|
||||
def test_create(self):
|
||||
room_type_obj = self.env['hotel.room.type']
|
||||
room_type = room_type_obj.sudo(self.user_hotel_manager).create({
|
||||
'name': 'Budget Room',
|
||||
'virtual_code': '001',
|
||||
'list_price': 50,
|
||||
'wrid': 1234
|
||||
})
|
||||
room_type.unlink()
|
||||
|
||||
def test_unlink(self):
|
||||
self.hotel_room_type_budget.sudo(self.user_hotel_manager).unlink()
|
||||
Reference in New Issue
Block a user