mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms:Added precheckin option in folio portal
This commit is contained in:
@@ -110,7 +110,7 @@ class PortalFolio(CustomerPortal):
|
||||
return request.render("pms.folio_portal_template", values)
|
||||
|
||||
@http.route(
|
||||
["/my/folios/precheckin/<int:folio_id>"], type="http", auth="user", website=True
|
||||
["/my/folios/<int:folio_id>/precheckin"], type="http", auth="user", website=True
|
||||
)
|
||||
def portal_my_folio_precheckin(
|
||||
self, folio_id, access_token=None, report_type=None, download=False, **kw
|
||||
@@ -123,13 +123,6 @@ class PortalFolio(CustomerPortal):
|
||||
)
|
||||
except (AccessError, MissingError):
|
||||
return request.redirect("/my")
|
||||
if report_type in ("html", "pdf", "text"):
|
||||
return self._show_report(
|
||||
model=folio_sudo,
|
||||
report_type=report_type,
|
||||
report_ref="pms.action_report_folio",
|
||||
download=download,
|
||||
)
|
||||
values = self._folio_get_page_view_values(folio_sudo, access_token, **kw)
|
||||
return request.render("pms.portal_my_folio_precheckin", values)
|
||||
|
||||
|
||||
@@ -770,40 +770,12 @@ class PmsFolio(models.Model):
|
||||
# else:
|
||||
# raise UserError(_("Some reservations have different currency"))
|
||||
|
||||
is_checkin = fields.Boolean(default=False)
|
||||
# is_checkin = fields.Boolean()
|
||||
|
||||
def _compute_access_url(self):
|
||||
super(PmsFolio, self)._compute_access_url()
|
||||
print(self.is_checkin)
|
||||
for folio in self:
|
||||
folio.access_url = "/my/folios/%s" % (folio.id)
|
||||
if self.is_checkin:
|
||||
folio.access_url = "/my/folios/precheckin/%s" % (folio.id)
|
||||
self.is_checkin = False
|
||||
|
||||
|
||||
def get_portal_url(
|
||||
self,
|
||||
suffix=None,
|
||||
report_type=None,
|
||||
download=None,
|
||||
query_string=None,
|
||||
anchor=None,
|
||||
bol=None,
|
||||
):
|
||||
self.ensure_one()
|
||||
if bol:
|
||||
self.is_checkin = True
|
||||
|
||||
url = self.access_url + '%s?access_token=%s%s%s%s%s' % (
|
||||
suffix if suffix else '',
|
||||
self._portal_ensure_token(),
|
||||
'&report_type=%s' % report_type if report_type else '',
|
||||
'&download=true' if download else '',
|
||||
query_string if query_string else '',
|
||||
'#%s' % anchor if anchor else ''
|
||||
)
|
||||
return url
|
||||
|
||||
@api.depends("state", "sale_line_ids.invoice_status")
|
||||
def _compute_get_invoice_status(self):
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<t t-esc="folio.name" />
|
||||
</a>
|
||||
<a
|
||||
t-att-href="folio.get_portal_url(bol=True)"
|
||||
t-att-href="folio.get_portal_url(suffix='/precheckin')"
|
||||
t-att-title="Precheckin"
|
||||
>Precheckin</a>
|
||||
</td>
|
||||
@@ -488,7 +488,8 @@
|
||||
<t t-set="title">Precheckins</t>
|
||||
</t>
|
||||
<t t-if="not folio.reservation_ids">
|
||||
<p>There are currently no reservations in this folio for your account.</p>
|
||||
<p
|
||||
>There are currently no reservations in this folio for your account.</p>
|
||||
</t>
|
||||
<t t-if="folio.reservation_ids" t-call="portal.portal_table">
|
||||
<thead>
|
||||
@@ -499,20 +500,21 @@
|
||||
<tbody>
|
||||
<t t-foreach="folio.reservation_ids" t-as="reservation">
|
||||
<tr class="bg-light">
|
||||
<td colspan="4"><em class="font-weight-normal text-muted"><span
|
||||
/>Reservation: </em>
|
||||
<td colspan="4"><em
|
||||
class="font-weight-normal text-muted"
|
||||
><span />Reservation: </em>
|
||||
<a
|
||||
t-att-href="reservation.get_portal_url()"
|
||||
t-att-title="reservation.name"
|
||||
>
|
||||
t-att-href="reservation.get_portal_url()"
|
||||
t-att-title="reservation.name"
|
||||
>
|
||||
<t t-esc="reservation.name" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<t
|
||||
t-foreach="reservation.checkin_partner_ids"
|
||||
t-as="checkin_partner"
|
||||
>
|
||||
t-foreach="reservation.checkin_partner_ids"
|
||||
t-as="checkin_partner"
|
||||
>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<a t-att-href="checkin_partner.get_portal_url()">
|
||||
@@ -521,15 +523,15 @@
|
||||
<div t-attf-class="form-group">
|
||||
<div class="col-2">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="name"
|
||||
>Name: </label>
|
||||
class="col-form-label"
|
||||
for="name"
|
||||
>Name: </label>
|
||||
<input
|
||||
type="text"
|
||||
name="name"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="name or checkin_partner.name"
|
||||
/>
|
||||
type="text"
|
||||
name="name"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="name or checkin_partner.name"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user