mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] Fix group reservations by folio (#87)
This commit is contained in:
@@ -158,15 +158,6 @@ 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"]
|
||||
|
||||
if date_begin and date_end:
|
||||
domain += [
|
||||
("create_date", ">", date_begin),
|
||||
@@ -183,6 +174,11 @@ class PortalReservation(CustomerPortal):
|
||||
reservations = Reservation.search(
|
||||
domain, limit=self._items_per_page, offset=pager["offset"]
|
||||
)
|
||||
folios_dict = {}
|
||||
for reservation in reservations:
|
||||
folio = reservation.folio_id
|
||||
folios_dict[folio] = ""
|
||||
|
||||
request.session["my_reservations_history"] = reservations.ids[:100]
|
||||
values.update(
|
||||
{
|
||||
@@ -191,8 +187,8 @@ class PortalReservation(CustomerPortal):
|
||||
"page_name": "reservations",
|
||||
"pager": pager,
|
||||
"default_url": "/my/reservations",
|
||||
# "searchbar_sortings": searchbar_sortings,
|
||||
# "sortby": sortby,
|
||||
"folios_dict": folios_dict,
|
||||
"partner": partner,
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_reservation", values)
|
||||
|
||||
@@ -55,38 +55,42 @@
|
||||
</tr>
|
||||
</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 by folio: </em>
|
||||
<a
|
||||
t-att-href="folio.get_portal_url()"
|
||||
t-att-title="folio.name"
|
||||
>
|
||||
<t t-esc="folio.name" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<t t-set="folio_old" t-value="" />
|
||||
<t t-foreach="folios_dict" t-as="folio">
|
||||
<t t-foreach="folio.reservation_ids" t-as="reservation">
|
||||
<t t-if="reservation.partner_id == partner">
|
||||
<t t-if="folio != folio_old">
|
||||
<tr class="bg-light">
|
||||
<td colspan="4"><em
|
||||
class="font-weight-normal text-muted"
|
||||
><span /> Reservations by folio: </em>
|
||||
<a
|
||||
t-att-href="folio.get_portal_url()"
|
||||
t-att-title="folio.name"
|
||||
>
|
||||
<t t-esc="folio.name" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
<t t-set="folio_old" t-value="folio" />
|
||||
<tr>
|
||||
<td>
|
||||
<a
|
||||
t-att-href="reservation.get_portal_url()"
|
||||
t-att-title="reservation.name"
|
||||
>
|
||||
<t t-esc="reservation.name" />
|
||||
</a>
|
||||
</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>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
<tr>
|
||||
<td>
|
||||
<a
|
||||
t-att-href="reservation.get_portal_url()"
|
||||
t-att-title="reservation.name"
|
||||
>
|
||||
<t t-esc="reservation.name" />
|
||||
</a>
|
||||
</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>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user