[ADD] Split information in popover

This commit is contained in:
Pablo
2019-01-21 13:34:34 +01:00
parent 12ca208b59
commit cd31fa0be7
4 changed files with 22 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ class BusHotelCalendar(models.TransientModel):
def _generate_reservation_notif(self, vals):
user_id = self.env['res.users'].browse(self.env.uid)
master_reserv = vals['parent_reservation'] or vals['reserv_id']
num_split = self.env['hotel.reservation'].search_count([
reserv_chunks = self.env['hotel.reservation'].search_count([
('folio_id', '=', vals['folio_id']),
'|', ('parent_reservation', '=', master_reserv),
('id', '=', master_reserv),
@@ -69,7 +69,7 @@ class BusHotelCalendar(models.TransientModel):
'checkout': vals['checkout'],
'arrival_hour': vals['arrival_hour'],
'departure_hour': vals['departure_hour'],
'num_split': num_split,
'reserv_chunks': reserv_chunks,
'amount_total': vals['amount_total'],
'pending_amount': vals['pending_amount'],
'amount_paid': vals['amount_paid'],

View File

@@ -93,6 +93,15 @@ class HotelReservation(models.Model):
'overbooking': reserv['overbooking'],
'state': reserv['state'],
'real_dates': [reserv['real_checkin'], reserv['real_checkout']]})
reserv_chunks = 1
if reserv['splitted']:
master_reserv = reserv['parent_reservation'] or reserv['folio_id']
reserv_chunks = self.search_count([
('folio_id', '=', reserv['folio_id']),
'|', ('parent_reservation', '=', master_reserv),
('id', '=', master_reserv),
('splitted', '=', True),
])
json_reservation_tooltips.update({
reserv['id']: {
'folio_name': reserv['folio_id'],
@@ -115,9 +124,12 @@ class HotelReservation(models.Model):
'type': reserv['reservation_type'] or 'normal',
'out_service_description': reserv['out_service_description']
or _('No reason given'),
'splitted': reserv['splitted'],
'reserv_chunks': reserv_chunks,
# TODO: Add Board Services and Extra Service as Cradle, Bed, ...
}
})
return (json_reservations, json_reservation_tooltips)
@api.model

View File

@@ -756,7 +756,8 @@ var PMSCalendarController = AbstractController.extend({
'pending_amount': Number(tp['pending_amount']).toLocaleString(),
'amount_paid': Number(tp['amount_paid']).toLocaleString(),
'reservation_type': tp['type'],
'out_service_description': tp['out_service_description']
'out_service_description': tp['out_service_description'],
'reserv_chunks': tp['reserv_chunks'],
};
},

View File

@@ -121,6 +121,11 @@
title="Close" />
</div>
</div>
<div class="row row-eq-height mt-10">
<t t-if="reserv_chunks > 1">
This reservation has been splitted in <t t-esc="reserv_chunks"/> chunks.
</t>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.Sale">
@@ -136,7 +141,7 @@
<p>Total Paid</p>
</div>
<div class="col-sm-6 bg-gray-light">
<t t-if="channel_type == 'web' or channel_type=='call'">
<t t-if="channel_type == 'web' or channel_type =='call'">
<t t-call="HotelCalendar.TooltipReservation.Channel.ota"/>
</t>
<t t-else="reservation_type == 'out'">