Both portals share the existing fusion.repair.intake.service so behaviour
stays identical across all three intake surfaces (backend wizard,
sales rep portal, public client portal).
Sales rep portal
- Hard depends on fusion_authorizer_portal (reuses is_sales_rep_portal
flag + group_sales_rep_portal scaffolding)
- /my/repair/new - mobile-friendly intake form with phone-first
partner search (jsonrpc lookup), category select, third-party flag,
urgency, photo capture
- /my/repairs - list of repairs the rep submitted (paginated)
- /my/repair/<id> - read-only detail with status, equipment, scheduled
visit
- Interaction-class JS (Odoo 19 public.interactions), safe DOM construction
- Mobile SCSS with 44px tap targets, sticky CTA on small screens
- Record rule scopes portal users to repairs where
x_fc_intake_user_id = user.id
Public client portal
- auth='public' - voicemail-ready /repair URL
- /repair - landing page with 911 disclaimer and Start CTA
- /repair/new - single-page form: contact, equipment, issue, urgency,
optional photos. QR pre-fill via ?sn=<serial>
- /repair/submit - CSRF + honeypot + per-IP rate limit (configurable);
finds or creates partner; calls intake service with sudo
- /repair/thanks - confirmation with reference number
- /repair/lookup_phone (jsonrpc) - safe partner match returning ONLY
masked name (first + last initial) + city (no other PII leakage)
Security fix: technician record rule on repair.order now uses STORED
fields (technician_id + additional_technician_ids) instead of the
non-stored all_technician_ids compute, which was failing SQL generation.
Verified end-to-end on local westin-v19:
- Sales rep create via intake service with the rep user context creates
the repair with x_fc_intake_source='sales_rep_portal' and proper
activities
- /repair/submit posts urlencoded data -> creates partner + repair
('BR-WA/RO/00010', source='client_portal', urgency='urgent') ->
redirects to /repair/thanks with the reference
Co-authored-by: Cursor <cursoragent@cursor.com>
282 lines
16 KiB
XML
282 lines
16 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
|
|
<!-- ============================================================== -->
|
|
<!-- Sales Rep Repair Intake Form -->
|
|
<!-- ============================================================== -->
|
|
<template id="portal_sales_rep_repair_form" name="Sales Rep - New Service Call">
|
|
<t t-call="portal.portal_layout">
|
|
<t t-set="breadcrumbs_searchbar" t-value="True"/>
|
|
|
|
<div class="o_portal_my_doc o_fusion_repairs_portal">
|
|
<div class="container py-4">
|
|
<div class="row justify-content-center">
|
|
<div class="col-12 col-lg-8">
|
|
|
|
<h2 class="mb-3">New Service Call</h2>
|
|
<p class="text-muted">
|
|
Submit a repair request on behalf of a client. The office will follow up to schedule a technician.
|
|
</p>
|
|
|
|
<t t-if="request.params.get('error') == 'partner'">
|
|
<div class="alert alert-danger">Please select a client.</div>
|
|
</t>
|
|
<t t-if="request.params.get('error') == 'server'">
|
|
<div class="alert alert-danger">An error occurred saving the request. Please try again.</div>
|
|
</t>
|
|
|
|
<form action="/my/repair/submit" method="POST"
|
|
enctype="multipart/form-data"
|
|
class="card shadow-sm">
|
|
<input type="hidden" name="csrf_token"
|
|
t-att-value="request.csrf_token()"/>
|
|
<div class="card-body p-4">
|
|
|
|
<!-- Step 1: Client lookup -->
|
|
<h5 class="mb-3">1. Client</h5>
|
|
<div class="mb-3">
|
|
<label class="form-label">Search by name, phone or email</label>
|
|
<input type="text"
|
|
id="partner_search"
|
|
class="form-control form-control-lg"
|
|
placeholder="Start typing..."
|
|
autocomplete="off"/>
|
|
<div id="partner_matches" class="list-group mt-2"></div>
|
|
<input type="hidden" name="partner_id" id="partner_id_input"/>
|
|
<div id="partner_selected" class="alert alert-info mt-2 d-none">
|
|
<strong>Selected:</strong>
|
|
<span id="partner_selected_name"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<!-- Step 2: Equipment -->
|
|
<h5 class="mb-3">2. Equipment</h5>
|
|
<div class="mb-3">
|
|
<label class="form-label">Equipment category</label>
|
|
<select name="category_id" class="form-select form-select-lg" required="required">
|
|
<option value="">Choose a category...</option>
|
|
<t t-foreach="categories" t-as="cat">
|
|
<option t-att-value="cat.id"
|
|
t-att-data-safety="1 if cat.safety_critical else 0">
|
|
<t t-out="cat.name"/>
|
|
</option>
|
|
</t>
|
|
</select>
|
|
</div>
|
|
<div class="form-check mb-3">
|
|
<input type="checkbox" class="form-check-input"
|
|
id="third_party" name="third_party"/>
|
|
<label class="form-check-label" for="third_party">
|
|
This equipment was not purchased from us
|
|
</label>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<!-- Step 3: Issue -->
|
|
<h5 class="mb-3">3. What's the issue?</h5>
|
|
<div class="mb-3">
|
|
<label class="form-label">Short summary</label>
|
|
<input type="text" name="issue_summary"
|
|
class="form-control form-control-lg"
|
|
placeholder="e.g. 'stairlift stops halfway up'"
|
|
required="required"/>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Symptom keyword (optional)</label>
|
|
<input type="text" name="issue_category"
|
|
class="form-control"
|
|
placeholder="e.g. battery, motor, remote"/>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Details / what the client said</label>
|
|
<textarea name="internal_notes" class="form-control" rows="3"
|
|
placeholder="Free-form notes from the call..."></textarea>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<!-- Step 4: Urgency -->
|
|
<h5 class="mb-3">4. Urgency</h5>
|
|
<div class="mb-3">
|
|
<select name="urgency" class="form-select form-select-lg" required="required">
|
|
<option value="normal" selected="selected">Normal (within a few days)</option>
|
|
<option value="urgent">Urgent (within 24 hours)</option>
|
|
<option value="safety">Safety issue (right now)</option>
|
|
</select>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<!-- Step 5: Photos -->
|
|
<h5 class="mb-3">5. Photos (optional)</h5>
|
|
<div class="mb-3">
|
|
<input type="file" name="photos"
|
|
class="form-control"
|
|
accept="image/*,video/*" multiple="multiple"
|
|
capture="environment"/>
|
|
<small class="text-muted">Tap to take a photo or pick from gallery.</small>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="card-footer text-end">
|
|
<button type="submit" class="btn btn-primary btn-lg">
|
|
Submit Service Call
|
|
</button>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</t>
|
|
</template>
|
|
|
|
<!-- ============================================================== -->
|
|
<!-- Sales Rep "My Service Calls" list -->
|
|
<!-- ============================================================== -->
|
|
<template id="portal_sales_rep_repair_list" name="Sales Rep - My Service Calls">
|
|
<t t-call="portal.portal_layout">
|
|
<div class="o_portal_my_doc o_fusion_repairs_portal">
|
|
<div class="container py-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h2>My Service Calls</h2>
|
|
<a href="/my/repair/new" class="btn btn-primary">+ New Service Call</a>
|
|
</div>
|
|
|
|
<t t-if="not repairs">
|
|
<div class="alert alert-info">
|
|
You haven't submitted any service calls yet.
|
|
<a href="/my/repair/new">Submit your first one.</a>
|
|
</div>
|
|
</t>
|
|
|
|
<div class="row g-3">
|
|
<t t-foreach="repairs" t-as="repair">
|
|
<div class="col-12 col-md-6">
|
|
<a t-att-href="'/my/repair/%s' % repair.id"
|
|
class="card text-decoration-none text-reset shadow-sm h-100">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<h5 class="card-title mb-1">
|
|
<t t-out="repair.name"/>
|
|
</h5>
|
|
<span t-attf-class="badge bg-#{'danger' if repair.x_fc_urgency == 'safety' else ('warning' if repair.x_fc_urgency == 'urgent' else 'secondary')}">
|
|
<t t-out="dict(repair._fields['x_fc_urgency'].selection).get(repair.x_fc_urgency)"/>
|
|
</span>
|
|
</div>
|
|
<p class="card-text small text-muted mb-1">
|
|
<i class="fa fa-user me-1"/>
|
|
<t t-out="repair.partner_id.name or 'Unknown'"/>
|
|
</p>
|
|
<p class="card-text small text-muted mb-1" t-if="repair.x_fc_repair_category_id">
|
|
<i class="fa fa-wrench me-1"/>
|
|
<t t-out="repair.x_fc_repair_category_id.name"/>
|
|
</p>
|
|
<p class="card-text small mb-0">
|
|
<span class="badge bg-light text-dark">
|
|
<t t-out="dict(repair._fields['state'].selection).get(repair.state)"/>
|
|
</span>
|
|
<span class="text-muted ms-2">
|
|
<t t-out="repair.create_date" t-options="{'widget': 'datetime'}"/>
|
|
</span>
|
|
</p>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
</t>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</t>
|
|
</template>
|
|
|
|
<!-- ============================================================== -->
|
|
<!-- Sales Rep Repair Detail -->
|
|
<!-- ============================================================== -->
|
|
<template id="portal_sales_rep_repair_detail" name="Sales Rep - Repair Detail">
|
|
<t t-call="portal.portal_layout">
|
|
<div class="o_portal_my_doc o_fusion_repairs_portal">
|
|
<div class="container py-4">
|
|
|
|
<t t-if="thanks">
|
|
<div class="alert alert-success">
|
|
Service call <strong><t t-out="repair.name"/></strong> submitted.
|
|
The office will follow up shortly to schedule a technician.
|
|
</div>
|
|
</t>
|
|
|
|
<div class="d-flex justify-content-between align-items-start mb-3">
|
|
<div>
|
|
<h2 class="mb-1"><t t-out="repair.name"/></h2>
|
|
<p class="text-muted mb-0">
|
|
<t t-out="dict(repair._fields['state'].selection).get(repair.state)"/>
|
|
<span class="ms-2">·</span>
|
|
<span class="ms-2">
|
|
<t t-out="repair.create_date" t-options="{'widget': 'datetime'}"/>
|
|
</span>
|
|
</p>
|
|
</div>
|
|
<a href="/my/repairs" class="btn btn-outline-secondary">Back to list</a>
|
|
</div>
|
|
|
|
<div class="card mb-3 shadow-sm">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Client</h5>
|
|
<p class="mb-1"><strong t-out="repair.partner_id.name"/></p>
|
|
<p class="text-muted small mb-0" t-if="repair.partner_id.phone">
|
|
<i class="fa fa-phone me-1"/><t t-out="repair.partner_id.phone"/>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mb-3 shadow-sm">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Equipment & Issue</h5>
|
|
<p class="mb-1" t-if="repair.x_fc_repair_category_id">
|
|
<strong>Category:</strong>
|
|
<t t-out="repair.x_fc_repair_category_id.name"/>
|
|
</p>
|
|
<p class="mb-1" t-if="repair.product_id">
|
|
<strong>Product:</strong>
|
|
<t t-out="repair.product_id.display_name"/>
|
|
</p>
|
|
<p class="mb-1">
|
|
<strong>Urgency:</strong>
|
|
<t t-out="dict(repair._fields['x_fc_urgency'].selection).get(repair.x_fc_urgency)"/>
|
|
</p>
|
|
<p class="mb-1" t-if="repair.x_fc_third_party_equipment">
|
|
<span class="badge bg-warning">Third-party equipment</span>
|
|
</p>
|
|
<p class="mb-0 mt-2" t-if="repair.internal_notes">
|
|
<div t-field="repair.internal_notes"/>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mb-3 shadow-sm" t-if="repair.x_fc_technician_task_count">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Scheduled Visit</h5>
|
|
<t t-foreach="repair.x_fc_technician_task_ids" t-as="task">
|
|
<p class="mb-1">
|
|
<i class="fa fa-calendar me-1"/>
|
|
<t t-out="task.scheduled_date"/>
|
|
<span class="ms-2">with <t t-out="task.technician_id.name"/></span>
|
|
<span t-attf-class="badge ms-2 bg-#{'success' if task.status == 'completed' else 'info'}">
|
|
<t t-out="dict(task._fields['status'].selection).get(task.status)"/>
|
|
</span>
|
|
</p>
|
|
</t>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</t>
|
|
</template>
|
|
|
|
</odoo>
|