mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP] precheckin detail
This commit is contained in:
@@ -220,16 +220,22 @@ class PortalPrecheckin(CustomerPortal):
|
||||
def _prepare_home_portal_values(self, counters):
|
||||
partner = request.env.user.partner_id
|
||||
values = super()._prepare_home_portal_values(counters)
|
||||
Reservation = request.env["pms.reservation"].search([("partner_id", "=", partner.id)])
|
||||
Reservation = request.env["pms.reservation"].search(
|
||||
[("partner_id", "=", partner.id)]
|
||||
)
|
||||
if "checkin_count" in counters:
|
||||
checkin_partner_count = len(Reservation.checkin_partner_ids)
|
||||
values["checkin_count"] = checkin_partner_count if Reservation.check_access_rights("read", raise_exception=False) else 0
|
||||
values["checkin_count"] = (
|
||||
checkin_partner_count
|
||||
if Reservation.check_access_rights("read", raise_exception=False)
|
||||
else 0
|
||||
)
|
||||
return values
|
||||
|
||||
def _precheckin_get_page_view_values(self, precheckin, access_token, **kwargs):
|
||||
values = {"precheckin": precheckin, "token": access_token}
|
||||
def _precheckin_get_page_view_values(self, checkin_partner, access_token, **kwargs):
|
||||
values = {"checkin_partner": checkin_partner, "token": access_token}
|
||||
return self._get_page_view_values(
|
||||
precheckin,
|
||||
checkin_partner,
|
||||
access_token,
|
||||
values,
|
||||
"my_precheckins_history",
|
||||
@@ -282,3 +288,23 @@ class PortalPrecheckin(CustomerPortal):
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_precheckin", values)
|
||||
|
||||
@http.route(
|
||||
["/my/precheckin/<int:checkin_partner_id>"],
|
||||
type="http",
|
||||
auth="user",
|
||||
website=True,
|
||||
)
|
||||
def portal_my_precheckin_detail(self, checkin_partner_id, access_token=None, **kw):
|
||||
try:
|
||||
checkin_sudo = self._document_check_access(
|
||||
"pms.checkin.partner",
|
||||
checkin_partner_id,
|
||||
access_token=access_token,
|
||||
)
|
||||
except (AccessError, MissingError):
|
||||
return request.redirect("/my")
|
||||
# for attachment in reservation_sudo.attachment_ids:
|
||||
# attachment.generate_access_token()
|
||||
values = self._precheckin_get_page_view_values(checkin_sudo, access_token, **kw)
|
||||
return request.render("pms.portal_my_precheckin_detail", values)
|
||||
|
||||
@@ -12,6 +12,7 @@ from odoo.tools.safe_eval import safe_eval
|
||||
class PmsCheckinPartner(models.Model):
|
||||
_name = "pms.checkin.partner"
|
||||
_description = "Partner Checkins"
|
||||
_inherit = ["portal.mixin"]
|
||||
_rec_name = "identifier"
|
||||
_check_pms_properties_auto = True
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template
|
||||
id="portal_my_home_menu_precheckin"
|
||||
@@ -13,10 +13,10 @@
|
||||
>
|
||||
<a t-attf-href="/my/precheckin?{{ keep_query() }}">Precheckin</a>
|
||||
</li>
|
||||
<li t-if="reservation" class="breadcrumb-item active">
|
||||
<a t-attf-href="/my/precheckin?{{ keep_query() }}">Precheckin/</a>
|
||||
<t t-esc="reservation.name" />
|
||||
</li>
|
||||
<!-- <li t-if="reservation" class="breadcrumb-item active">-->
|
||||
<!-- <a t-attf-href="/my/precheckin?{{ keep_query() }}">Precheckin/</a>-->
|
||||
<!-- <t t-esc="reservation.name" />-->
|
||||
<!-- </li>-->
|
||||
</xpath>
|
||||
</template>
|
||||
<template
|
||||
@@ -35,6 +35,8 @@
|
||||
</xpath>
|
||||
</template>
|
||||
<template id="portal_my_precheckin" name="My PreCheckins">
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>-->
|
||||
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">-->
|
||||
<t t-call="portal.portal_layout">
|
||||
<t t-set="breadcrumbs_searchbar" t-value="True" />
|
||||
|
||||
@@ -66,9 +68,8 @@
|
||||
</tr>
|
||||
</t>
|
||||
<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"
|
||||
@@ -77,10 +78,29 @@
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<t t-foreach="reservation.checkin_partner_ids" t-as="checkin_partner">
|
||||
<t
|
||||
t-foreach="reservation.checkin_partner_ids"
|
||||
t-as="checkin_partner"
|
||||
>
|
||||
<tr>
|
||||
<td>
|
||||
<a>Checkin</a>
|
||||
<td colspan="4">
|
||||
<a t-att-href="checkin_partner.get_portal_url()">
|
||||
Checkin
|
||||
</a>
|
||||
<div t-attf-class="form-group">
|
||||
<div class="col-2">
|
||||
<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"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
@@ -89,4 +109,139 @@
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="portal_my_precheckin_detail" name="My Precheckin">
|
||||
<t t-call="portal.portal_layout">
|
||||
<t t-set="additional_title">Contact Details</t>
|
||||
<form action="/my/precheckin" method="post">
|
||||
<!-- <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>-->
|
||||
<div class="row o_portal_details">
|
||||
<div class="col-lg-8">
|
||||
<div class="row">
|
||||
<!-- <t t-set="partner_can_edit_vat" t-value="partner.can_edit_vat()"/>-->
|
||||
<!-- <div class="col-lg-12">-->
|
||||
<!-- <div t-if="error_message" class="alert alert-danger" role="alert">-->
|
||||
<!-- <t t-foreach="error_message" t-as="err"><t t-esc="err"/><br /></t>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<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.firstname"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="name"
|
||||
>Lastname</label>
|
||||
<input
|
||||
type="text"
|
||||
name="lastname"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="lastname or checkin_partner.lastname"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- <div class="clearfix" />-->
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="name"
|
||||
> Second Lastname</label>
|
||||
<input
|
||||
type="text"
|
||||
name="second_lastname"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="lastname2 or checkin_partner.lastname2"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="name"
|
||||
> Birth Date</label>
|
||||
<input
|
||||
type="text"
|
||||
name="birth_date"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="birth_date or checkin_partner.birthdate_date"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label class="col-form-label" for="name">Gender</label>
|
||||
<input
|
||||
type="text"
|
||||
name="gender"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="gender or checkin_partner.gender"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="name"
|
||||
>Doc. type</label>
|
||||
<input
|
||||
type="text"
|
||||
name="doc_type"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="doc_type or checkin_partner.document_type"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="name"
|
||||
>Doc. number</label>
|
||||
<input
|
||||
type="text"
|
||||
name="doc_number"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="doc_number or checkin_partner.document_number"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="name"
|
||||
>Doc. expedition date</label>
|
||||
<input
|
||||
type="text"
|
||||
name="doc_exp_date"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="doc_exp_date or checkin_partner.document_expedition_date"
|
||||
/>
|
||||
</div>
|
||||
<!-- <div t-attf-class="form-group col-xl-6">-->
|
||||
<!-- <label class="col-form-label" for="name">Phone</label>-->
|
||||
<!-- <input type="text" name="phone" t-attf-class="form-control" t-att-value="phone or checkin_partner.phone" />-->
|
||||
<!-- </div>-->
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label class="col-form-label" for="name">Mobile</label>
|
||||
<input
|
||||
type="text"
|
||||
name="mobile"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="mobile or checkin_partner.mobile"
|
||||
/>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-xl-6">
|
||||
<label class="col-form-label" for="name">Email</label>
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
t-attf-class="form-control"
|
||||
t-att-value="email or checkin_partner.email"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user