feat(fusion_repairs): Phase 1 sales rep + public client portals
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>
This commit is contained in:
@@ -4,3 +4,4 @@
|
||||
|
||||
from . import models
|
||||
from . import wizard
|
||||
from . import controllers
|
||||
|
||||
@@ -80,6 +80,9 @@ Copyright (C) 2024-2026 Nexa Systems Inc. All rights reserved.
|
||||
'views/res_partner_views.xml',
|
||||
'views/res_users_views.xml',
|
||||
'views/res_config_settings_views.xml',
|
||||
# Portal templates
|
||||
'views/portal_sales_rep_templates.xml',
|
||||
'views/portal_client_repair_templates.xml',
|
||||
# Wizard
|
||||
'wizard/repair_intake_wizard_views.xml',
|
||||
# Menus (last, after all referenced actions exist)
|
||||
@@ -90,7 +93,9 @@ Copyright (C) 2024-2026 Nexa Systems Inc. All rights reserved.
|
||||
# Phase 2+: history_sidebar.js, signature_pad.js, etc.
|
||||
],
|
||||
'web.assets_frontend': [
|
||||
# Phase 1+: portal_client_repair.js etc.
|
||||
'fusion_repairs/static/src/scss/portal_repair_mobile.scss',
|
||||
'fusion_repairs/static/src/scss/portal_client_repair.scss',
|
||||
'fusion_repairs/static/src/js/portal_repair_intake.js',
|
||||
],
|
||||
},
|
||||
'images': ['static/description/icon.png'],
|
||||
|
||||
6
fusion_repairs/controllers/__init__.py
Normal file
6
fusion_repairs/controllers/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2024-2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
|
||||
from . import portal_sales_rep_repair
|
||||
from . import portal_client_repair
|
||||
240
fusion_repairs/controllers/portal_client_repair.py
Normal file
240
fusion_repairs/controllers/portal_client_repair.py
Normal file
@@ -0,0 +1,240 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2024-2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
|
||||
"""Public client self-service portal at /repair.
|
||||
|
||||
Phase 1 scope (no AI yet):
|
||||
- /repair Landing page with "Start" CTA
|
||||
- /repair/new Multi-step form
|
||||
- /repair/submit POST -> creates repair.order via shared intake service
|
||||
- /repair/thanks Confirmation with reference
|
||||
- /repair/lookup_phone jsonrpc safe partner match (masked PII)
|
||||
|
||||
Security:
|
||||
- Public auth (no login) - the voicemail prompts mention this URL
|
||||
- Per-IP rate limit on submit (configurable)
|
||||
- Honeypot + CSRF
|
||||
- Phone lookup returns ONLY masked name + address slice (never other PII)
|
||||
- Records created via sudo in the controller; record rules don't apply
|
||||
because anonymous users don't have a session
|
||||
|
||||
Phase 2+ will add: AI self-check, upsell engine, smart SMS verify,
|
||||
safety on-call paging, reCAPTCHA v3.
|
||||
"""
|
||||
|
||||
import base64
|
||||
import hashlib
|
||||
import logging
|
||||
import re
|
||||
import time
|
||||
|
||||
from odoo import http, fields
|
||||
from odoo.http import request
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# In-memory rate-limit window per worker. Good enough for Phase 1
|
||||
# and matches the project's "no extra infra" goal. Resets on restart.
|
||||
_RATE_LIMIT_BUCKET = {}
|
||||
|
||||
|
||||
def _now_hour_bucket():
|
||||
return int(time.time() // 3600)
|
||||
|
||||
|
||||
def _mask_partner_for_lookup(partner):
|
||||
"""Return ONLY safe summary fields - never the full partner record."""
|
||||
name = partner.name or ""
|
||||
# First name + last initial; never reveal full surname.
|
||||
if " " in name:
|
||||
first, last = name.split(" ", 1)
|
||||
safe_name = f"{first} {(last or ' ')[:1]}."
|
||||
else:
|
||||
safe_name = name
|
||||
return {
|
||||
"matched": True,
|
||||
"name": safe_name,
|
||||
"city": partner.city or "",
|
||||
}
|
||||
|
||||
|
||||
def _e164_clean(phone):
|
||||
if not phone:
|
||||
return ""
|
||||
return re.sub(r"[^\d+]", "", phone)[-12:]
|
||||
|
||||
|
||||
class ClientRepairPortal(http.Controller):
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# RATE LIMIT
|
||||
# ------------------------------------------------------------------
|
||||
def _check_rate_limit(self):
|
||||
ICP = request.env["ir.config_parameter"].sudo()
|
||||
try:
|
||||
limit = int(ICP.get_param(
|
||||
"fusion_repairs.client_portal_rate_limit_per_hour", "10"
|
||||
))
|
||||
except (ValueError, TypeError):
|
||||
limit = 10
|
||||
# Use remote_addr from the proxy header if present.
|
||||
ip = (
|
||||
request.httprequest.headers.get("X-Forwarded-For")
|
||||
or request.httprequest.remote_addr
|
||||
or "unknown"
|
||||
)
|
||||
ip = ip.split(",")[0].strip()
|
||||
bucket = _now_hour_bucket()
|
||||
key = f"{ip}:{bucket}"
|
||||
# Prune old buckets (cheap - dict is small).
|
||||
for k in list(_RATE_LIMIT_BUCKET.keys()):
|
||||
if not k.endswith(f":{bucket}"):
|
||||
_RATE_LIMIT_BUCKET.pop(k, None)
|
||||
_RATE_LIMIT_BUCKET[key] = _RATE_LIMIT_BUCKET.get(key, 0) + 1
|
||||
if _RATE_LIMIT_BUCKET[key] > limit:
|
||||
return True # blocked
|
||||
return False
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# LANDING
|
||||
# ------------------------------------------------------------------
|
||||
@http.route("/repair", type="http", auth="public", website=True, sitemap=True)
|
||||
def repair_landing(self, **kw):
|
||||
return request.render("fusion_repairs.portal_client_repair_landing", {
|
||||
"page_name": "client_repair_landing",
|
||||
})
|
||||
|
||||
@http.route("/repair/new", type="http", auth="public", website=True,
|
||||
sitemap=False)
|
||||
def repair_new(self, sn=None, **kw):
|
||||
categories = request.env["fusion.repair.product.category"].sudo().search([
|
||||
("active", "=", True),
|
||||
], order="sequence, name")
|
||||
prefilled_serial = (sn or "").strip()
|
||||
return request.render("fusion_repairs.portal_client_repair_form", {
|
||||
"page_name": "client_repair_new",
|
||||
"categories": categories,
|
||||
"prefilled_serial": prefilled_serial,
|
||||
"error": kw.get("error"),
|
||||
})
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# SAFE PARTNER LOOKUP (anti-leak)
|
||||
# ------------------------------------------------------------------
|
||||
@http.route("/repair/lookup_phone", type="jsonrpc", auth="public",
|
||||
website=True)
|
||||
def repair_lookup_phone(self, phone=None, **kw):
|
||||
if self._check_rate_limit():
|
||||
return {"error": "rate_limited"}
|
||||
cleaned = _e164_clean(phone)
|
||||
if len(cleaned) < 7:
|
||||
return {"matched": False}
|
||||
matches = request.env["res.partner"].sudo().search([
|
||||
"|",
|
||||
("phone", "ilike", cleaned[-7:]),
|
||||
("phone_sanitized", "ilike", cleaned[-7:]),
|
||||
], limit=1)
|
||||
if matches:
|
||||
return _mask_partner_for_lookup(matches[0])
|
||||
return {"matched": False}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# SUBMIT
|
||||
# ------------------------------------------------------------------
|
||||
@http.route("/repair/submit", type="http", auth="public", methods=["POST"],
|
||||
csrf=True, website=True)
|
||||
def repair_submit(self, **post):
|
||||
# Honeypot - bots tend to fill every visible field.
|
||||
if (post.get("hp_company") or "").strip():
|
||||
_logger.info("Client portal submit blocked by honeypot from IP=%s",
|
||||
request.httprequest.remote_addr)
|
||||
return request.redirect("/repair/new?error=spam")
|
||||
|
||||
if self._check_rate_limit():
|
||||
return request.redirect("/repair/new?error=rate_limited")
|
||||
|
||||
# Required fields.
|
||||
partner_name = (post.get("client_name") or "").strip()
|
||||
phone = (post.get("client_phone") or "").strip()
|
||||
issue_summary = (post.get("issue_summary") or "").strip()
|
||||
category_id = int(post.get("category_id") or 0)
|
||||
|
||||
if not (partner_name and phone and issue_summary and category_id):
|
||||
return request.redirect("/repair/new?error=missing")
|
||||
|
||||
# Find or create partner. Match by phone if known (safe - we already
|
||||
# have their consent to contact via this form).
|
||||
cleaned_phone = _e164_clean(phone)
|
||||
partner = False
|
||||
if len(cleaned_phone) >= 7:
|
||||
partner = request.env["res.partner"].sudo().search([
|
||||
"|",
|
||||
("phone", "ilike", cleaned_phone[-7:]),
|
||||
("phone_sanitized", "ilike", cleaned_phone[-7:]),
|
||||
], limit=1)
|
||||
|
||||
partner_vals = None
|
||||
if not partner:
|
||||
partner_vals = {
|
||||
"name": partner_name,
|
||||
"phone": phone,
|
||||
"email": (post.get("client_email") or "").strip(),
|
||||
"street": (post.get("client_street") or "").strip(),
|
||||
"city": (post.get("client_city") or "").strip(),
|
||||
}
|
||||
|
||||
# Stage uploaded photos.
|
||||
files = request.httprequest.files.getlist("photos")
|
||||
attachment_ids = []
|
||||
for f in files or []:
|
||||
if not getattr(f, "filename", None):
|
||||
continue
|
||||
data = f.read()
|
||||
if not data:
|
||||
continue
|
||||
attachment_ids.append(request.env["ir.attachment"].sudo().create({
|
||||
"name": f.filename,
|
||||
"datas": base64.b64encode(data),
|
||||
"res_model": "fusion.repair.intake.session",
|
||||
"res_id": 0,
|
||||
}).id)
|
||||
|
||||
equipment = {
|
||||
"repair_category_id": category_id,
|
||||
"third_party": post.get("third_party") in ("on", "true", "1"),
|
||||
"urgency": post.get("urgency") or "normal",
|
||||
"issue_summary": issue_summary,
|
||||
"internal_notes": (post.get("internal_notes") or "").strip(),
|
||||
"photo_attachment_ids": attachment_ids,
|
||||
}
|
||||
payload = {
|
||||
"partner_id": partner.id if partner else None,
|
||||
"partner_vals": partner_vals,
|
||||
"intake_user_id": request.env.ref(
|
||||
"base.user_admin", raise_if_not_found=False).id
|
||||
if request.env.ref("base.user_admin",
|
||||
raise_if_not_found=False) else 1,
|
||||
"equipment_items": [equipment],
|
||||
}
|
||||
|
||||
try:
|
||||
repairs = request.env["fusion.repair.intake.service"].sudo() \
|
||||
.create_repair_orders(payload, source="client_portal")
|
||||
except Exception:
|
||||
_logger.exception("Client portal repair submit failed")
|
||||
return request.redirect("/repair/new?error=server")
|
||||
|
||||
token = hashlib.sha256(
|
||||
f"{repairs[0].id}:{repairs[0].create_date}".encode()
|
||||
).hexdigest()[:16]
|
||||
return request.redirect(f"/repair/thanks?ref={repairs[0].name}&t={token}")
|
||||
|
||||
@http.route("/repair/thanks", type="http", auth="public", website=True,
|
||||
sitemap=False)
|
||||
def repair_thanks(self, ref=None, t=None, **kw):
|
||||
return request.render("fusion_repairs.portal_client_repair_thanks", {
|
||||
"page_name": "client_repair_thanks",
|
||||
"ref": ref or "",
|
||||
})
|
||||
186
fusion_repairs/controllers/portal_sales_rep_repair.py
Normal file
186
fusion_repairs/controllers/portal_sales_rep_repair.py
Normal file
@@ -0,0 +1,186 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2024-2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
|
||||
"""Sales rep portal for repair intake.
|
||||
|
||||
Sales reps marked `is_sales_rep_portal` on their partner can:
|
||||
- /my/repair/new - submit a new service call from their phone
|
||||
- /my/repairs - list of repairs they have submitted
|
||||
- /my/repair/<id> - read-only detail with status timeline
|
||||
|
||||
All routes are gated by the is_sales_rep_portal flag and use the SAME
|
||||
shared intake service (`fusion.repair.intake.service`) as the backend
|
||||
wizard - so behaviour stays consistent across surfaces.
|
||||
"""
|
||||
|
||||
import base64
|
||||
import logging
|
||||
|
||||
from odoo import http, fields
|
||||
from odoo.http import request
|
||||
from odoo.addons.portal.controllers.portal import CustomerPortal
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SalesRepRepairPortal(CustomerPortal):
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# ACCESS GATE
|
||||
# ------------------------------------------------------------------
|
||||
def _check_sales_rep_access(self):
|
||||
partner = request.env.user.partner_id
|
||||
if not getattr(partner, 'is_sales_rep_portal', False):
|
||||
return request.redirect('/my')
|
||||
return None
|
||||
|
||||
def _staged_attachment_ids_from_files(self, files):
|
||||
"""Stage uploaded files as ir.attachment records and return their IDs."""
|
||||
ids = []
|
||||
for f in files or []:
|
||||
if not getattr(f, 'filename', None):
|
||||
continue
|
||||
data = f.read()
|
||||
if not data:
|
||||
continue
|
||||
attachment = request.env['ir.attachment'].sudo().create({
|
||||
'name': f.filename,
|
||||
'datas': base64.b64encode(data),
|
||||
'res_model': 'fusion.repair.intake.session',
|
||||
'res_id': 0,
|
||||
})
|
||||
ids.append(attachment.id)
|
||||
return ids
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# NEW SERVICE CALL FORM
|
||||
# ------------------------------------------------------------------
|
||||
@http.route('/my/repair/new', type='http', auth='user', website=True, sitemap=False)
|
||||
def portal_repair_new(self, **kw):
|
||||
gate = self._check_sales_rep_access()
|
||||
if gate:
|
||||
return gate
|
||||
|
||||
categories = request.env['fusion.repair.product.category'].sudo().search([
|
||||
('active', '=', True),
|
||||
], order='sequence, name')
|
||||
|
||||
return request.render('fusion_repairs.portal_sales_rep_repair_form', {
|
||||
'page_name': 'repair_new',
|
||||
'categories': categories,
|
||||
'default_partner': False,
|
||||
'submitted': False,
|
||||
})
|
||||
|
||||
@http.route('/my/repair/lookup_partner', type='jsonrpc', auth='user', website=True)
|
||||
def portal_repair_lookup_partner(self, query=None, **kw):
|
||||
gate = self._check_sales_rep_access()
|
||||
if gate:
|
||||
return {'error': 'access'}
|
||||
if not query or len(query) < 3:
|
||||
return {'matches': []}
|
||||
Partner = request.env['res.partner'].sudo()
|
||||
matches = Partner.search([
|
||||
'|', '|',
|
||||
('name', 'ilike', query),
|
||||
('phone', 'ilike', query),
|
||||
('email', 'ilike', query),
|
||||
], limit=8)
|
||||
return {
|
||||
'matches': [{
|
||||
'id': p.id,
|
||||
'name': p.name or '',
|
||||
'phone': p.phone or '',
|
||||
'email': p.email or '',
|
||||
'street': p.street or '',
|
||||
'city': p.city or '',
|
||||
'repair_count': p.x_fc_repair_count,
|
||||
} for p in matches],
|
||||
}
|
||||
|
||||
@http.route('/my/repair/submit', type='http', auth='user', methods=['POST'],
|
||||
csrf=True, website=True)
|
||||
def portal_repair_submit(self, **post):
|
||||
gate = self._check_sales_rep_access()
|
||||
if gate:
|
||||
return gate
|
||||
|
||||
partner_id = int(post.get('partner_id') or 0)
|
||||
if not partner_id:
|
||||
return request.redirect('/my/repair/new?error=partner')
|
||||
|
||||
# Build single-equipment payload from the form. Multi-equipment loop
|
||||
# is supported by adding more equipment_* groups in Phase 2.
|
||||
files = request.httprequest.files.getlist('photos')
|
||||
attachment_ids = self._staged_attachment_ids_from_files(files)
|
||||
|
||||
equipment = {
|
||||
'repair_category_id': int(post.get('category_id') or 0) or False,
|
||||
'product_id': int(post.get('product_id') or 0) or False,
|
||||
'third_party': post.get('third_party') in ('on', 'true', '1'),
|
||||
'urgency': post.get('urgency') or 'normal',
|
||||
'issue_summary': (post.get('issue_summary') or '').strip(),
|
||||
'issue_category': (post.get('issue_category') or '').strip(),
|
||||
'internal_notes': (post.get('internal_notes') or '').strip(),
|
||||
'photo_attachment_ids': attachment_ids,
|
||||
}
|
||||
|
||||
payload = {
|
||||
'partner_id': partner_id,
|
||||
'intake_user_id': request.env.uid,
|
||||
'equipment_items': [equipment],
|
||||
}
|
||||
|
||||
try:
|
||||
repairs = request.env['fusion.repair.intake.service'].sudo() \
|
||||
.create_repair_orders(payload, source='sales_rep_portal')
|
||||
except Exception as e:
|
||||
_logger.exception('Sales rep portal repair submit failed')
|
||||
return request.redirect('/my/repair/new?error=server')
|
||||
|
||||
return request.redirect('/my/repair/%d?thanks=1' % repairs[0].id)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# MY REPAIRS LIST + DETAIL
|
||||
# ------------------------------------------------------------------
|
||||
@http.route(['/my/repairs', '/my/repairs/page/<int:page>'], type='http',
|
||||
auth='user', website=True)
|
||||
def portal_repairs_list(self, page=1, **kw):
|
||||
gate = self._check_sales_rep_access()
|
||||
if gate:
|
||||
return gate
|
||||
|
||||
Repair = request.env['repair.order'].sudo()
|
||||
domain = [('x_fc_intake_user_id', '=', request.env.uid)]
|
||||
|
||||
total = Repair.search_count(domain)
|
||||
page_size = 20
|
||||
offset = (page - 1) * page_size
|
||||
repairs = Repair.search(domain, order='create_date desc',
|
||||
limit=page_size, offset=offset)
|
||||
|
||||
return request.render('fusion_repairs.portal_sales_rep_repair_list', {
|
||||
'page_name': 'repairs_list',
|
||||
'repairs': repairs,
|
||||
'total': total,
|
||||
'page': page,
|
||||
'page_size': page_size,
|
||||
})
|
||||
|
||||
@http.route('/my/repair/<int:repair_id>', type='http', auth='user',
|
||||
website=True)
|
||||
def portal_repair_detail(self, repair_id, thanks=None, **kw):
|
||||
gate = self._check_sales_rep_access()
|
||||
if gate:
|
||||
return gate
|
||||
|
||||
repair = request.env['repair.order'].sudo().browse(repair_id).exists()
|
||||
if not repair or repair.x_fc_intake_user_id.id != request.env.uid:
|
||||
return request.redirect('/my/repairs')
|
||||
|
||||
return request.render('fusion_repairs.portal_sales_rep_repair_detail', {
|
||||
'page_name': 'repair_detail',
|
||||
'repair': repair,
|
||||
'thanks': bool(thanks),
|
||||
})
|
||||
@@ -53,11 +53,12 @@
|
||||
<field name="global" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- Field technicians (from fusion_tasks) see only repairs they're assigned to as technician on a linked task -->
|
||||
<!-- Field technicians (from fusion_tasks) see only repairs they're assigned to as technician on a linked task.
|
||||
Uses STORED fields (technician_id + additional_technician_ids) - not the computed all_technician_ids. -->
|
||||
<record id="rule_repair_order_technician_own" model="ir.rule">
|
||||
<field name="name">Repair Order: Technician sees own repairs</field>
|
||||
<field name="model_id" ref="repair.model_repair_order"/>
|
||||
<field name="domain_force">[('x_fc_technician_task_ids.all_technician_ids', 'in', [user.id])]</field>
|
||||
<field name="domain_force">['|', ('x_fc_technician_task_ids.technician_id', '=', user.id), ('x_fc_technician_task_ids.additional_technician_ids', 'in', [user.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('fusion_tasks.group_field_technician'))]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
@@ -73,4 +74,16 @@
|
||||
<field name="global" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- Sales Rep Portal: sees only repair orders they submitted -->
|
||||
<record id="rule_repair_order_sales_rep_portal" model="ir.rule">
|
||||
<field name="name">Repair Order: Sales Rep Portal - Own Repairs</field>
|
||||
<field name="model_id" ref="repair.model_repair_order"/>
|
||||
<field name="domain_force">[('x_fc_intake_user_id', '=', user.id)]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="False"/>
|
||||
<field name="perm_create" eval="False"/>
|
||||
<field name="perm_unlink" eval="False"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
107
fusion_repairs/static/src/js/portal_repair_intake.js
Normal file
107
fusion_repairs/static/src/js/portal_repair_intake.js
Normal file
@@ -0,0 +1,107 @@
|
||||
/** @odoo-module **/
|
||||
// Sales rep portal - new service call form interactions.
|
||||
// Uses Odoo 19 public Interaction class per project frontend rules
|
||||
// (NOT IIFE / DOMContentLoaded). Uses only safe DOM construction
|
||||
// (textContent + createElement) - no innerHTML, no XSS risk.
|
||||
|
||||
import { Interaction } from "@web/public/interaction";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { rpc } from "@web/core/network/rpc";
|
||||
|
||||
export class SalesRepRepairIntake extends Interaction {
|
||||
static selector = ".o_fusion_repairs_portal";
|
||||
|
||||
dynamicContent = {
|
||||
"#partner_search": {
|
||||
"t-on-input": this._onPartnerSearchInput,
|
||||
},
|
||||
};
|
||||
|
||||
setup() {
|
||||
this._partnerSearchTimer = null;
|
||||
}
|
||||
|
||||
_onPartnerSearchInput(ev) {
|
||||
const query = (ev.target.value || "").trim();
|
||||
if (this._partnerSearchTimer) {
|
||||
clearTimeout(this._partnerSearchTimer);
|
||||
}
|
||||
if (query.length < 3) {
|
||||
this._renderMatches([]);
|
||||
return;
|
||||
}
|
||||
this._partnerSearchTimer = setTimeout(async () => {
|
||||
try {
|
||||
const result = await rpc("/my/repair/lookup_partner", { query });
|
||||
this._renderMatches(result.matches || []);
|
||||
} catch (e) {
|
||||
this._renderMatches([]);
|
||||
}
|
||||
}, 250);
|
||||
}
|
||||
|
||||
_renderMatches(matches) {
|
||||
const list = document.getElementById("partner_matches");
|
||||
if (!list) {
|
||||
return;
|
||||
}
|
||||
while (list.firstChild) {
|
||||
list.removeChild(list.firstChild);
|
||||
}
|
||||
for (const m of matches) {
|
||||
list.appendChild(this._buildMatchItem(m));
|
||||
}
|
||||
}
|
||||
|
||||
_buildMatchItem(m) {
|
||||
const item = document.createElement("button");
|
||||
item.type = "button";
|
||||
item.className = "list-group-item list-group-item-action text-start";
|
||||
|
||||
const nameStrong = document.createElement("strong");
|
||||
nameStrong.textContent = m.name || "";
|
||||
item.appendChild(nameStrong);
|
||||
|
||||
if (m.phone) {
|
||||
const phone = document.createElement("span");
|
||||
phone.className = "text-muted ms-2";
|
||||
phone.textContent = m.phone;
|
||||
item.appendChild(phone);
|
||||
}
|
||||
|
||||
if (m.repair_count) {
|
||||
const badge = document.createElement("span");
|
||||
badge.className = "badge bg-secondary ms-2";
|
||||
badge.textContent = `${m.repair_count} repair(s)`;
|
||||
item.appendChild(badge);
|
||||
}
|
||||
|
||||
if (m.street) {
|
||||
const addr = document.createElement("div");
|
||||
addr.className = "small text-muted";
|
||||
addr.textContent = [m.street, m.city].filter(Boolean).join(", ");
|
||||
item.appendChild(addr);
|
||||
}
|
||||
|
||||
item.addEventListener("click", () => this._selectPartner(m));
|
||||
return item;
|
||||
}
|
||||
|
||||
_selectPartner(m) {
|
||||
document.getElementById("partner_id_input").value = m.id;
|
||||
document.getElementById("partner_selected_name").textContent =
|
||||
m.name + (m.phone ? ` (${m.phone})` : "");
|
||||
document
|
||||
.getElementById("partner_selected")
|
||||
.classList.remove("d-none");
|
||||
const list = document.getElementById("partner_matches");
|
||||
while (list.firstChild) {
|
||||
list.removeChild(list.firstChild);
|
||||
}
|
||||
document.getElementById("partner_search").value = m.name;
|
||||
}
|
||||
}
|
||||
|
||||
registry
|
||||
.category("public.interactions")
|
||||
.add("fusion_repairs.sales_rep_intake", SalesRepRepairIntake);
|
||||
39
fusion_repairs/static/src/scss/portal_client_repair.scss
Normal file
39
fusion_repairs/static/src/scss/portal_client_repair.scss
Normal file
@@ -0,0 +1,39 @@
|
||||
/* Public client portal - mobile-first.
|
||||
* Follows project SCSS rules: no hardcoded theme colours, large tap targets,
|
||||
* adapts to website light/dark theme automatically.
|
||||
*/
|
||||
|
||||
.o_fusion_repairs_client {
|
||||
.form-control,
|
||||
.form-select,
|
||||
.btn {
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.btn-lg {
|
||||
min-height: 56px;
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
border-radius: 0.75rem;
|
||||
}
|
||||
|
||||
h1.display-5,
|
||||
h2 {
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
@media (max-width: 575px) {
|
||||
section {
|
||||
padding-top: 1.5rem !important;
|
||||
padding-bottom: 1.5rem !important;
|
||||
}
|
||||
.card-footer {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
background: inherit;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
fusion_repairs/static/src/scss/portal_repair_mobile.scss
Normal file
39
fusion_repairs/static/src/scss/portal_repair_mobile.scss
Normal file
@@ -0,0 +1,39 @@
|
||||
/* Sales rep portal - mobile-first additions.
|
||||
* Follows project CLAUDE.md rules:
|
||||
* - Tap targets >=44px
|
||||
* - No hardcoded theme colours
|
||||
* - Cards float on a slightly grayer page background
|
||||
*/
|
||||
|
||||
.o_fusion_repairs_portal {
|
||||
.card {
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
.form-control,
|
||||
.form-select,
|
||||
.btn {
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.btn-lg {
|
||||
min-height: 52px;
|
||||
}
|
||||
|
||||
#partner_matches {
|
||||
.list-group-item {
|
||||
padding: 0.75rem 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sticky bottom CTA on small screens for the submit form. */
|
||||
@media (max-width: 575px) {
|
||||
.card-footer {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
background: inherit;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
185
fusion_repairs/views/portal_client_repair_templates.xml
Normal file
185
fusion_repairs/views/portal_client_repair_templates.xml
Normal file
@@ -0,0 +1,185 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- /repair landing -->
|
||||
<!-- ============================================================== -->
|
||||
<template id="portal_client_repair_landing" name="Repair - Landing">
|
||||
<t t-call="website.layout">
|
||||
<div id="wrap" class="o_fusion_repairs_client">
|
||||
<section class="container py-5">
|
||||
<div class="row justify-content-center text-center">
|
||||
<div class="col-12 col-lg-8">
|
||||
<h1 class="display-5 fw-bold">Need a repair?</h1>
|
||||
<p class="lead text-muted mb-4">
|
||||
Tell us about your equipment and what's going wrong.
|
||||
We'll respond on the next business day - or sooner if it's urgent.
|
||||
</p>
|
||||
<a href="/repair/new" class="btn btn-primary btn-lg px-5 py-3">
|
||||
Start a Service Request
|
||||
</a>
|
||||
<div class="text-muted mt-4 small">
|
||||
<i class="fa fa-shield-alt me-1"/>
|
||||
Your information is private and used only to schedule your repair.
|
||||
</div>
|
||||
<div class="alert alert-warning mt-4 text-start">
|
||||
<strong>Is anyone hurt right now?</strong>
|
||||
If you have a medical emergency, please hang up and dial <strong>9-1-1</strong>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- /repair/new form -->
|
||||
<!-- ============================================================== -->
|
||||
<template id="portal_client_repair_form" name="Repair - Form">
|
||||
<t t-call="website.layout">
|
||||
<div id="wrap" class="o_fusion_repairs_client">
|
||||
<section class="container py-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-lg-7">
|
||||
<h2 class="mb-3">Service Request</h2>
|
||||
<p class="text-muted">
|
||||
Fill in the form below. A team member will follow up shortly.
|
||||
</p>
|
||||
|
||||
<t t-if="error == 'missing'">
|
||||
<div class="alert alert-danger">Please fill in all required fields.</div>
|
||||
</t>
|
||||
<t t-if="error == 'spam'">
|
||||
<div class="alert alert-danger">Submission blocked. If this is a mistake, please call our office.</div>
|
||||
</t>
|
||||
<t t-if="error == 'rate_limited'">
|
||||
<div class="alert alert-warning">Too many requests from your location. Please try again in an hour.</div>
|
||||
</t>
|
||||
<t t-if="error == 'server'">
|
||||
<div class="alert alert-danger">Something went wrong. Please try again or call us directly.</div>
|
||||
</t>
|
||||
|
||||
<form action="/repair/submit" method="POST"
|
||||
enctype="multipart/form-data" class="card shadow-sm">
|
||||
<input type="hidden" name="csrf_token"
|
||||
t-att-value="request.csrf_token()"/>
|
||||
<!-- Honeypot. Real users never see this. -->
|
||||
<div style="position:absolute;left:-9999px;top:-9999px;" aria-hidden="true">
|
||||
<label>Company name</label>
|
||||
<input type="text" name="hp_company" tabindex="-1" autocomplete="off"/>
|
||||
</div>
|
||||
|
||||
<div class="card-body p-4">
|
||||
|
||||
<h5>1. Your contact details</h5>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Your name <span class="text-danger">*</span></label>
|
||||
<input type="text" name="client_name" class="form-control form-control-lg" required="required"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Phone number <span class="text-danger">*</span></label>
|
||||
<input type="tel" name="client_phone" class="form-control form-control-lg" required="required" placeholder="(519) 555-1234"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Email (so we can send a confirmation)</label>
|
||||
<input type="email" name="client_email" class="form-control"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Street address</label>
|
||||
<input type="text" name="client_street" class="form-control"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">City</label>
|
||||
<input type="text" name="client_city" class="form-control"/>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h5>2. What equipment needs service?</h5>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Equipment category <span class="text-danger">*</span></label>
|
||||
<select name="category_id" class="form-select form-select-lg" required="required">
|
||||
<option value="">Choose one...</option>
|
||||
<t t-foreach="categories" t-as="cat">
|
||||
<option t-att-value="cat.id">
|
||||
<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">
|
||||
I didn't buy this equipment from Fusion / Westin
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h5>3. What's wrong?</h5>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Short description <span class="text-danger">*</span></label>
|
||||
<input type="text" name="issue_summary" class="form-control form-control-lg" required="required" placeholder="e.g. 'stairlift beeps and won't move'"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Anything else we should know?</label>
|
||||
<textarea name="internal_notes" class="form-control" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Photos or short video (optional)</label>
|
||||
<input type="file" name="photos" class="form-control" accept="image/*,video/*" multiple="multiple" capture="environment"/>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h5>4. How urgent is it?</h5>
|
||||
<div class="mb-3">
|
||||
<select name="urgency" class="form-select form-select-lg" required="required">
|
||||
<option value="normal">Normal - within a few days</option>
|
||||
<option value="urgent">Urgent - within 24 hours</option>
|
||||
<option value="safety">Safety issue - right now</option>
|
||||
</select>
|
||||
<small class="text-muted">
|
||||
If anyone is hurt, hang up and call <strong>9-1-1</strong>.
|
||||
</small>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-footer text-end">
|
||||
<button type="submit" class="btn btn-primary btn-lg">
|
||||
Submit Request
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- /repair/thanks -->
|
||||
<!-- ============================================================== -->
|
||||
<template id="portal_client_repair_thanks" name="Repair - Thanks">
|
||||
<t t-call="website.layout">
|
||||
<div id="wrap" class="o_fusion_repairs_client">
|
||||
<section class="container py-5">
|
||||
<div class="row justify-content-center text-center">
|
||||
<div class="col-12 col-lg-7">
|
||||
<i class="fa fa-check-circle fa-4x text-success mb-3"/>
|
||||
<h1 class="mb-3">Got it!</h1>
|
||||
<p class="lead text-muted">
|
||||
Your service request <strong t-if="ref"><t t-out="ref"/></strong> was received.
|
||||
We'll get back to you on the next business day or sooner if you marked it urgent.
|
||||
</p>
|
||||
<a href="/repair" class="btn btn-outline-secondary mt-3">Back to home</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
281
fusion_repairs/views/portal_sales_rep_templates.xml
Normal file
281
fusion_repairs/views/portal_sales_rep_templates.xml
Normal file
@@ -0,0 +1,281 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user