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)
|
return request.render("pms.folio_portal_template", values)
|
||||||
|
|
||||||
@http.route(
|
@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(
|
def portal_my_folio_precheckin(
|
||||||
self, folio_id, access_token=None, report_type=None, download=False, **kw
|
self, folio_id, access_token=None, report_type=None, download=False, **kw
|
||||||
@@ -123,13 +123,6 @@ class PortalFolio(CustomerPortal):
|
|||||||
)
|
)
|
||||||
except (AccessError, MissingError):
|
except (AccessError, MissingError):
|
||||||
return request.redirect("/my")
|
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)
|
values = self._folio_get_page_view_values(folio_sudo, access_token, **kw)
|
||||||
return request.render("pms.portal_my_folio_precheckin", values)
|
return request.render("pms.portal_my_folio_precheckin", values)
|
||||||
|
|
||||||
|
|||||||
@@ -770,40 +770,12 @@ class PmsFolio(models.Model):
|
|||||||
# else:
|
# else:
|
||||||
# raise UserError(_("Some reservations have different currency"))
|
# raise UserError(_("Some reservations have different currency"))
|
||||||
|
|
||||||
is_checkin = fields.Boolean(default=False)
|
# is_checkin = fields.Boolean()
|
||||||
|
|
||||||
def _compute_access_url(self):
|
def _compute_access_url(self):
|
||||||
super(PmsFolio, self)._compute_access_url()
|
super(PmsFolio, self)._compute_access_url()
|
||||||
print(self.is_checkin)
|
|
||||||
for folio in self:
|
for folio in self:
|
||||||
folio.access_url = "/my/folios/%s" % (folio.id)
|
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")
|
@api.depends("state", "sale_line_ids.invoice_status")
|
||||||
def _compute_get_invoice_status(self):
|
def _compute_get_invoice_status(self):
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
<t t-esc="folio.name" />
|
<t t-esc="folio.name" />
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
t-att-href="folio.get_portal_url(bol=True)"
|
t-att-href="folio.get_portal_url(suffix='/precheckin')"
|
||||||
t-att-title="Precheckin"
|
t-att-title="Precheckin"
|
||||||
>Precheckin</a>
|
>Precheckin</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -488,7 +488,8 @@
|
|||||||
<t t-set="title">Precheckins</t>
|
<t t-set="title">Precheckins</t>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not folio.reservation_ids">
|
<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 t-if="folio.reservation_ids" t-call="portal.portal_table">
|
<t t-if="folio.reservation_ids" t-call="portal.portal_table">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -499,20 +500,21 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<t t-foreach="folio.reservation_ids" t-as="reservation">
|
<t t-foreach="folio.reservation_ids" t-as="reservation">
|
||||||
<tr class="bg-light">
|
<tr class="bg-light">
|
||||||
<td colspan="4"><em class="font-weight-normal text-muted"><span
|
<td colspan="4"><em
|
||||||
/>Reservation: </em>
|
class="font-weight-normal text-muted"
|
||||||
|
><span />Reservation: </em>
|
||||||
<a
|
<a
|
||||||
t-att-href="reservation.get_portal_url()"
|
t-att-href="reservation.get_portal_url()"
|
||||||
t-att-title="reservation.name"
|
t-att-title="reservation.name"
|
||||||
>
|
>
|
||||||
<t t-esc="reservation.name" />
|
<t t-esc="reservation.name" />
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<t
|
<t
|
||||||
t-foreach="reservation.checkin_partner_ids"
|
t-foreach="reservation.checkin_partner_ids"
|
||||||
t-as="checkin_partner"
|
t-as="checkin_partner"
|
||||||
>
|
>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4">
|
<td colspan="4">
|
||||||
<a t-att-href="checkin_partner.get_portal_url()">
|
<a t-att-href="checkin_partner.get_portal_url()">
|
||||||
@@ -521,15 +523,15 @@
|
|||||||
<div t-attf-class="form-group">
|
<div t-attf-class="form-group">
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<label
|
<label
|
||||||
class="col-form-label"
|
class="col-form-label"
|
||||||
for="name"
|
for="name"
|
||||||
>Name: </label>
|
>Name: </label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="name"
|
name="name"
|
||||||
t-attf-class="form-control"
|
t-attf-class="form-control"
|
||||||
t-att-value="name or checkin_partner.name"
|
t-att-value="name or checkin_partner.name"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user