mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] group reservations by folio in portal
This commit is contained in:
@@ -158,14 +158,14 @@ class PortalReservation(CustomerPortal):
|
||||
domain = [
|
||||
("partner_id", "child_of", partner.id),
|
||||
]
|
||||
searchbar_sortings = {
|
||||
"date": {"label": _("Order Date"), "reservation": "date_order desc"},
|
||||
"name": {"label": _("Reference"), "reservation": "name"},
|
||||
"stage": {"label": _("Stage"), "reservation": "state"},
|
||||
}
|
||||
if not sortby:
|
||||
sortby = "date"
|
||||
sort_order = searchbar_sortings[sortby]["reservation"]
|
||||
# searchbar_sortings = {
|
||||
# "date": {"label": _("Order Date"), "reservation": "date_order desc"},
|
||||
# "name": {"label": _("Reference"), "reservation": "name"},
|
||||
# "stage": {"label": _("Stage"), "reservation": "state"},
|
||||
# }
|
||||
# if not sortby:
|
||||
# sortby = "date"
|
||||
# sort_order = searchbar_sortings[sortby]["reservation"]
|
||||
|
||||
if date_begin and date_end:
|
||||
domain += [
|
||||
@@ -175,13 +175,13 @@ class PortalReservation(CustomerPortal):
|
||||
reservation_count = Reservation.search_count(domain)
|
||||
pager = portal_pager(
|
||||
url="/my/reservations",
|
||||
url_args={"date_begin": date_begin, "date_end": date_end, "sortby": sortby},
|
||||
url_args={"date_begin": date_begin, "date_end": date_end},
|
||||
total=reservation_count,
|
||||
page=page,
|
||||
step=self._items_per_page,
|
||||
)
|
||||
reservations = Reservation.search(
|
||||
domain, order=sort_order, limit=self._items_per_page, offset=pager["offset"]
|
||||
domain, limit=self._items_per_page, offset=pager["offset"]
|
||||
)
|
||||
request.session["my_reservations_history"] = reservations.ids[:100]
|
||||
values.update(
|
||||
@@ -191,8 +191,8 @@ class PortalReservation(CustomerPortal):
|
||||
"page_name": "reservations",
|
||||
"pager": pager,
|
||||
"default_url": "/my/reservations",
|
||||
"searchbar_sortings": searchbar_sortings,
|
||||
"sortby": sortby,
|
||||
# "searchbar_sortings": searchbar_sortings,
|
||||
# "sortby": sortby,
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_reservation", values)
|
||||
|
||||
@@ -56,6 +56,20 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="reservations" t-as="reservation">
|
||||
<t t-set="folio" t-value="reservation.folio_id"/>
|
||||
<!-- Sacar folio-->
|
||||
<t t-if="reservation == folio.reservation_ids[0]">
|
||||
<tr class="bg-light">
|
||||
<td colspan="4"><em class="font-weight-normal text-muted"><span/> Reservations for folio: </em>
|
||||
<a
|
||||
t-att-href="folio.get_portal_url()"
|
||||
t-att-title="folio.name"
|
||||
>
|
||||
<t t-esc="folio.name" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
<tr>
|
||||
<td>
|
||||
<a
|
||||
@@ -67,9 +81,9 @@
|
||||
</td>
|
||||
<td><span t-field="reservation.checkin" /></td>
|
||||
<td><span t-field="reservation.checkout" /></td>
|
||||
<!-- <td class="text-right"><span-->
|
||||
<!-- t-field="reservation.price_room_services_set"-->
|
||||
<!-- /></td>-->
|
||||
<td class="text-right"><span
|
||||
t-field="reservation.price_room_services_set"
|
||||
/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
@@ -166,8 +180,11 @@
|
||||
<tbody>
|
||||
<t t-foreach="reservation.service_ids" t-as="service">
|
||||
<t t-if="service.is_board_service">
|
||||
<t t-set="board_service"
|
||||
t-value="reservation.board_service_room_id.pms_board_service_id"
|
||||
/>
|
||||
<tr>
|
||||
<td><span t-field="service.name" /></td>
|
||||
<td><span t-esc="board_service.name" /></td>
|
||||
<td><span t-field="service.product_qty" /></td>
|
||||
<td><span t-field="service.price_unit" /></td>
|
||||
</tr>
|
||||
@@ -176,8 +193,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</t>
|
||||
<div class="row mb-4" t-if="reservation.partner_id">
|
||||
<div class="col-12 col-md-6 pb-2" t-if="reservation.partner_id">
|
||||
|
||||
<div class="row mb-4" t-if="reservation.partner_id.is_agency">
|
||||
<div class="col-12 col-md-6 pb-2" t-if="reservation.partner_id.is_agency">
|
||||
<strong>Assigned to</strong>
|
||||
<div class="row">
|
||||
<div class="col flex-grow-0 pr-3">
|
||||
@@ -202,58 +220,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="coll-12 col-md-6 pb-2"
|
||||
t-if="reservation.partner_id"
|
||||
>
|
||||
<strong>Reported by</strong>
|
||||
<div class="row">
|
||||
<div class="col flex-grow-0 pr-3">
|
||||
<img
|
||||
t-if="reservation.partner_id.image_1024"
|
||||
class="rounded-circle mt-1 o_portal_contact_img"
|
||||
t-att-src="image_data_uri(reservation.partner_id.image_1024)"
|
||||
alt="Contact"
|
||||
/>
|
||||
<img
|
||||
t-else=""
|
||||
class="rounded-circle mt-1 o_portal_contact_img"
|
||||
src="/web/static/src/img/user_menu_avatar.png"
|
||||
alt="Contact"
|
||||
/>
|
||||
</div>
|
||||
<div class="col pl-md-0">
|
||||
<div
|
||||
t-field="reservation.partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["name", "email", "phone"]}'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="row" t-if="reservation.description">-->
|
||||
<!-- <div t-if="reservation.description" t-attf-class="col-12 col-lg-7 mb-4 mb-md-0 ">-->
|
||||
<!-- <hr class="mb-1"/>-->
|
||||
<!-- <div class="d-flex my-2">-->
|
||||
<!-- <strong>Description</strong>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="py-1 px-2 bg-100 small" t-field="reservation.description"/>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div t-if="reservation.attachment_ids" t-attf-class="col-12 col-lg-5 o_project_portal_attachments {{'col-lg-5' if reservation.description else 'col-lg-12'}}">-->
|
||||
<!-- <hr class="mb-1 d-none d-lg-block"/>-->
|
||||
<!-- <strong class="d-block mb-2">Attachments</strong>-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div t-attf-class="col {{'col-lg-6' if not reservation.description else 'col-lg-12'}}">-->
|
||||
<!-- <ul class="list-group">-->
|
||||
<!-- <a class="list-group-item list-group-item-action d-flex align-items-center oe_attachments py-1 px-2" t-foreach='reservation.attachment_ids' t-as='attachment' t-attf-href="/web/content/#{attachment.id}?download=true&access_token=#{attachment.access_token}" target="_blank" data-no-post-process="">-->
|
||||
<!-- <div class='oe_attachment_embedded o_image o_image_small mr-2 mr-lg-3' t-att-title="attachment.name" t-att-data-mimetype="attachment.mimetype" t-attf-data-src="/web/image/#{attachment.id}/50x40?access_token=#{attachment.access_token}"/>-->
|
||||
<!-- <div class='oe_attachment_name text-truncate'><t t-esc='attachment.name'/></div>-->
|
||||
<!-- </a>-->
|
||||
<!-- </ul>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
</t>
|
||||
</t>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user