Skip to content

Commit 5dfb50e

Browse files
author
John75SunCity
committed
fix: Wrap frontdesk.visitor template section in conditional check
- The My Visit History section in portal_my_inventory template references frontdesk.visitor model which requires the Frontdesk module - Added conditional check: t-if="'frontdesk.visitor' in request.env" - This prevents KeyError crash when Frontdesk module is not installed - Section will only display when the Frontdesk app is available
1 parent e1b5ea6 commit 5dfb50e

File tree

1 file changed

+64
-61
lines changed

1 file changed

+64
-61
lines changed

records_management/templates/my_portal_inventory.xml

Lines changed: 64 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -418,72 +418,75 @@
418418
</div>
419419

420420
<!-- New: My Visit History Section (Integrated for self-service auditing) -->
421-
<div class="o_portal_visit_history mt-5">
422-
<div class="card">
423-
<div class="card-header bg-info text-white">
424-
<h5 class="mb-0">
425-
<i class="fa fa-calendar-check"></i>
426-
My Visit History
427-
</h5>
428-
</div>
429-
<div class="card-body">
430-
<p>View your past visits, linked shred transactions, and download destruction certificates for NAID compliance.</p>
431-
<div class="table-responsive">
432-
<table class="table table-striped">
433-
<thead class="thead-dark">
434-
<tr>
435-
<th>Visit Date</th>
436-
<th>Service</th>
437-
<th>Transaction</th>
438-
<th>Certificate</th>
439-
</tr>
440-
</thead>
441-
<tbody>
442-
<t t-foreach="request.env['frontdesk.visitor'].search([('partner_id', '=', request.env.user.partner_id.id)])" t-as="visit">
421+
<!-- Only show if Frontdesk module is installed -->
422+
<t t-if="'frontdesk.visitor' in request.env">
423+
<div class="o_portal_visit_history mt-5">
424+
<div class="card">
425+
<div class="card-header bg-info text-white">
426+
<h5 class="mb-0">
427+
<i class="fa fa-calendar-check"></i>
428+
My Visit History
429+
</h5>
430+
</div>
431+
<div class="card-body">
432+
<p>View your past visits, linked shred transactions, and download destruction certificates for NAID compliance.</p>
433+
<div class="table-responsive">
434+
<table class="table table-striped">
435+
<thead class="thead-dark">
443436
<tr>
444-
<td><t t-esc="visit.check_in.strftime('%Y-%m-%d %H:%M') if visit.check_in else '-'"/></td>
445-
<td>
446-
<t t-if="visit.is_shred_customer">
447-
<span class="badge badge-success">Shredding Service</span>
448-
</t>
449-
<t t-else="">
450-
<span class="badge badge-secondary">General Visit</span>
451-
</t>
452-
</td>
453-
<td>
454-
<t t-if="visit.pos_order_id">
455-
<a t-attf-href="/my/orders/#{visit.pos_order_id.id}"><t t-esc="visit.pos_order_id.name"/></a>
456-
</t>
457-
<t t-else="">
458-
<span class="text-muted">No Transaction</span>
459-
</t>
460-
</td>
461-
<td>
462-
<t t-if="visit.pos_order_id">
463-
<a t-attf-href="/my/certificates/#{visit.id}" class="btn btn-sm btn-primary">
464-
<i class="fa fa-download"></i> Download Certificate
465-
</a>
466-
</t>
467-
<t t-else="">
468-
<span class="text-muted">N/A</span>
469-
</t>
470-
</td>
437+
<th>Visit Date</th>
438+
<th>Service</th>
439+
<th>Transaction</th>
440+
<th>Certificate</th>
471441
</tr>
472-
</t>
473-
</tbody>
474-
</table>
475-
</div>
476-
<div class="mt-3">
477-
<button class="btn btn-primary" t-attf-onclick="window.location.href='/my/schedule-visit'">Schedule a Visit</button>
478-
</div>
479-
<!-- Modern Filter for Visits -->
480-
<div class="form-group mt-3">
481-
<label for="date_filter">Filter by Date:</label>
482-
<input type="date" id="date_filter" class="form-control" placeholder="Select date" onchange="filterVisitsByDate(this.value)"/>
442+
</thead>
443+
<tbody>
444+
<t t-foreach="request.env['frontdesk.visitor'].search([('partner_id', '=', request.env.user.partner_id.id)])" t-as="visit">
445+
<tr>
446+
<td><t t-esc="visit.check_in.strftime('%Y-%m-%d %H:%M') if visit.check_in else '-'"/></td>
447+
<td>
448+
<t t-if="visit.is_shred_customer">
449+
<span class="badge badge-success">Shredding Service</span>
450+
</t>
451+
<t t-else="">
452+
<span class="badge badge-secondary">General Visit</span>
453+
</t>
454+
</td>
455+
<td>
456+
<t t-if="visit.pos_order_id">
457+
<a t-attf-href="/my/orders/#{visit.pos_order_id.id}"><t t-esc="visit.pos_order_id.name"/></a>
458+
</t>
459+
<t t-else="">
460+
<span class="text-muted">No Transaction</span>
461+
</t>
462+
</td>
463+
<td>
464+
<t t-if="visit.pos_order_id">
465+
<a t-attf-href="/my/certificates/#{visit.id}" class="btn btn-sm btn-primary">
466+
<i class="fa fa-download"></i> Download Certificate
467+
</a>
468+
</t>
469+
<t t-else="">
470+
<span class="text-muted">N/A</span>
471+
</t>
472+
</td>
473+
</tr>
474+
</t>
475+
</tbody>
476+
</table>
477+
</div>
478+
<div class="mt-3">
479+
<button class="btn btn-primary" t-attf-onclick="window.location.href='/my/schedule-visit'">Schedule a Visit</button>
480+
</div>
481+
<!-- Modern Filter for Visits -->
482+
<div class="form-group mt-3">
483+
<label for="date_filter">Filter by Date:</label>
484+
<input type="date" id="date_filter" class="form-control" placeholder="Select date" onchange="filterVisitsByDate(this.value)"/>
485+
</div>
483486
</div>
484487
</div>
485488
</div>
486-
</div>
489+
</t>
487490

488491
<!-- Removed inline legacy JS: visit date filter and inventory init now handled via Owl component & future dedicated module. -->
489492
</t>

0 commit comments

Comments
 (0)