[ADD] OTA info in popover

This commit is contained in:
Pablo
2019-02-07 20:41:30 +01:00
parent 2a8cede165
commit f7d9164235
3 changed files with 16 additions and 8 deletions

View File

@@ -11,6 +11,7 @@ class HotelReservation(models.Model):
@api.multi @api.multi
def _hcalendar_reservation_data(self, reservations): def _hcalendar_reservation_data(self, reservations):
vals = super(HotelReservation, self)._hcalendar_reservation_data(reservations) vals = super(HotelReservation, self)._hcalendar_reservation_data(reservations)
# TODO: Improve performance by doing a SQL as in get_hcalendar_reservations_data()
hotel_reservation_obj = self.env['hotel.reservation'] hotel_reservation_obj = self.env['hotel.reservation']
for v_rval in vals[0]: for v_rval in vals[0]:
reserv = hotel_reservation_obj.browse(v_rval['id']) reserv = hotel_reservation_obj.browse(v_rval['id'])
@@ -18,9 +19,12 @@ class HotelReservation(models.Model):
'fix_days': reserv.splitted or reserv.is_from_ota, 'fix_days': reserv.splitted or reserv.is_from_ota,
}) })
# Update tooltips # Update tooltips
vals[1][reserv.id].update({ if any(reserv.channel_bind_ids):
'ota_name': reserv.channel_bind_ids[0].ota_id.name if any(reserv.channel_bind_ids) else False vals[1][reserv.id].update({
}) 'ota_name': reserv.channel_bind_ids[0].ota_id.name,
'ota_reservation_id': reserv.channel_bind_ids[0].ota_reservation_id,
'external_id': reserv.channel_bind_ids[0].external_id,
})
return vals return vals
@api.multi @api.multi

View File

@@ -34,6 +34,8 @@ var PMSHotelCalendarController = PMSCalendarController.include({
_generate_reservation_tooltip_dict: function(tp) { _generate_reservation_tooltip_dict: function(tp) {
var qdict = this._super(tp); var qdict = this._super(tp);
qdict['ota_name'] = tp['ota_name']; qdict['ota_name'] = tp['ota_name'];
qdict['ota_reservation_id'] = tp['ota_reservation_id'];
qdict['external_id'] = tp['external_id'];
return qdict; return qdict;
}, },

View File

@@ -9,14 +9,16 @@
<t t-jquery="#channel_info" t-operation="replace"> <t t-jquery="#channel_info" t-operation="replace">
<div class="row row-eq-height"> <div class="row row-eq-height">
<div class="col-sm-12 bg-gray-light"> <div class="col-sm-12 bg-gray-light">
WuBook: 1544109684 WuBook: <t t-esc="external_id"/>
</div> </div>
</div> </div>
<div class="row row-eq-height"> <t t-if="ota_name">
<div class="col-sm-12 bg-gray-light"> <div class="row row-eq-height">
<t t-esc="ota_name"/>: 4253096846 <div class="col-sm-12 bg-gray-light">
<t t-esc="ota_name"/>: <t t-esc="ota_reservation_id"/>
</div>
</div> </div>
</div> </t>
</t> </t>
</t> </t>