[ADD] Add Services Popover information

This commit is contained in:
Pablo
2019-01-23 19:13:38 +01:00
parent 024b601a90
commit 9827a5df2c
7 changed files with 26 additions and 4 deletions

View File

@@ -193,6 +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>
</record>
<record id="hotel_service_3" model="product.product">

View File

@@ -1,7 +1,8 @@
# Copyright 2017 Alexandre Díaz
# Copyright 2017 Dario Lodeiros
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields
from odoo import models, fields
class ProductTemplate(models.Model):
_inherit = "product.template"
@@ -10,3 +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.')

View File

@@ -12,6 +12,7 @@
<group>
<field name="is_extra_bed" />
<field name="daily_limit" />
<field name="is_popoverable" />
</group>
<group>
<field name="per_day" />

View File

@@ -73,6 +73,7 @@ class BusHotelCalendar(models.TransientModel):
'real_dates': vals['real_dates'],
'channel_type': vals['channel_type'],
'board_service_name': vals['board_service_name'],
'services': vals['services'],
}
}

View File

@@ -121,6 +121,7 @@ class HotelReservation(models.Model):
'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'],
'services': reserv['services'],
}
})
@@ -195,6 +196,8 @@ class HotelReservation(models.Model):
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,
rcr.name as closure_reason,
@@ -209,11 +212,15 @@ class HotelReservation(models.Model):
ON hf.closure_reason_id = rcr.id
LEFT JOIN hotel_board_service_room_type_rel AS hbsrt ON hr.board_service_room_id = hbsrt.id
LEFT JOIN hotel_board_service AS hbs ON hbsrt.hotel_board_service_id = hbs.id
LEFT JOIN hotel_service AS hs ON hr.id = hs.ser_room_line
LEFT JOIN product_product AS pp2 ON hs.product_id = pp2.id
LEFT JOIN product_template AS pt2 ON pp2.product_tmpl_id = pt2.id
WHERE room_id IN %s AND (
(checkin <= %s AND checkout >= %s AND checkout <= %s)
OR (checkin >= %s AND checkout <= %s)
OR (checkin >= %s AND checkin <= %s AND checkout >= %s)
OR (checkin <= %s AND checkout >= %s))
GROUP BY hr.id, hf.id, pt.name, rcr.name, hbs.name, rp.mobile, rp.phone, rp.email, rp.name
ORDER BY checkin DESC, checkout ASC, adults DESC, children DESC
''', (tuple(rooms.ids),
rdfrom_str, rdfrom_str, dto_str,
@@ -418,6 +425,8 @@ class HotelReservation(models.Model):
'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,
'services': [service.product_id.name for service in self.service_ids
if service.product_id.is_popoverable],
}
@api.multi

View File

@@ -761,6 +761,7 @@ var PMSCalendarController = AbstractController.extend({
'splitted': tp['splitted'],
'channel_type': tp['channel_type'],
'board_service_name': tp['board_service_name'],
'services': tp['services'],
};
},

View File

@@ -131,9 +131,14 @@
</div>
</div>
<div class="row row-eq-height mt-10">
<t t-if="splitted">
This reservation is part of splitted reservation. You can check it in the corresponding Folio.
</t>
<div class="col-sm-12">
<t t-if="services != False">
<i class="fa fa-exclamation-circle fa-pull-left"/> This reservation requires: <t t-esc="services"/>
</t>
<t t-if="splitted">
<p>This reservation is part of splitted reservation. You can check it in the corresponding Folio.</p>
</t>
</div>
</div>
</t>
@@ -255,6 +260,7 @@
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation">
<t t-call="HotelCalendar.TooltipReservation.#{ reservation_type }"/>
</t>