Files
Odoo-Modules/fusion_repairs/wizard/repair_intake_wizard_views.xml
gsinghpal ebbadb3002 feat(fusion_repairs): Bundle 8 - rush service + emergency pricing + parts-ordered workflow
The grumpy-old-customer-with-broken-stairlift scenario. Four real workflows
the office faces every week, with comms baked in so the client never has to
call back asking for status.

NEW MODELS
- fusion.repair.emergency.charge (rate card)
  Per (category, tier) rate with per_tech_multiplier; 5 tiers
  (same_day / next_day / after_hours / weekend / holiday). Each category
  can have its own rates - bed motors need 2 techs, stairlift is single.
  Seeded with realistic Westin rates: stairlift same-day $250, weekend
  $450; porch lift same-day $300; bed same-day $175 with 0.6 multiplier
  (2-tech jobs frequent); powerchair same-day $200.

- fusion.repair.part.order (procurement-facing record)
  One per distinct part the tech needs from the manufacturer. Carries
  description + OEM # + manufacturer + quantity + photos + notes.
  4-state lifecycle: draft -> ordered -> received -> fitted (or
  cancelled). On state transitions:
    draft -> ordered:  email client "ordered, expected by X"
    ordered -> received: email client "arrived, scheduling return visit"
                         + auto-create follow-up dispatch task when ALL
                         outstanding parts on the repair have arrived.

REPAIR.ORDER EXTENSIONS
- Rush fields: x_fc_rush_requested, x_fc_rush_tier,
  x_fc_rush_techs_required, x_fc_rush_surcharge (computed via rate card),
  x_fc_rush_acknowledged_at + x_fc_rush_acknowledged_by_id (audit trail
  proving CS got verbal OK before charging).
- Parts-awaiting fields: x_fc_parts_awaiting + x_fc_parts_eta_date +
  x_fc_part_order_ids One2many + x_fc_part_order_count.

- New methods:
  * action_acknowledge_rush() - one-click "client agreed" with audit.
  * action_squeeze_into_today() - picks the lightest-loaded skilled tech,
    finds their first free 1-hour slot between 9am-6pm, schedules the
    task in it, sends:
      1) live bus.bus push to the tech (sticky notification in their
         web client - so they see it MID-SHIFT)
      2) rush-alert email (force_send=True - this can't wait in the queue)
      3) chatter post on the tech task itself
    Validates against fusion_tasks' time-conflict rule by passing
    force_schedule via context (intake.service honours it).
  * action_view_part_orders() - smart button.

WIZARD EXTENSIONS
- repair.intake.wizard:
  New rush_requested + rush_tier + rush_techs_required + rush_acknowledged
  controls. Live rush_surcharge_preview compute shows CS the price in
  real-time as they change category / tier / tech count. Yellow alert
  reminds CS to read the price to the client BEFORE submitting.

- repair.visit.report.wizard:
  New outcome radio: completed / parts_needed / rescheduled.
  When outcome=parts_needed, needs_parts_line_ids One2many appears for
  the tech to capture each part (description, OEM, manufacturer, qty,
  lead days, notes, photos). On submit each line creates a
  fusion.repair.part.order, the repair flips to x_fc_parts_awaiting=True
  with an ETA, and the client gets the "we found the problem, here's the
  plan" email immediately.

INTAKE SERVICE
- _create_dispatch_task now honours force_schedule (date + time_start +
  time_end) via context so squeeze + auto-redispatch don't crash on
  fusion_tasks' time-window validator.
- _create_single_repair carries rush_requested/tier/techs through to
  the new repair fields.

MAIL TEMPLATES (4 new)
- email_template_rush_tech_alert: red 4px accent, address + phone + the
  $surcharge - what the tech needs to know mid-shift.
- email_template_repair_awaiting_parts: amber accent, "we found the
  problem, parts ordered, return visit ~ETA, no action needed".
- email_template_parts_ordered: blue, per-part confirmation.
- email_template_parts_received: green, "arrived, office will call to
  confirm visit".

UI / NAVIGATION
- Backend wizard: rush controls + live surcharge preview + verbal-OK alert.
- repair.order form: new Rush / Parts notebook tab with all the fields
  + linked part orders list. Two new header buttons (Squeeze into
  Today / Client Agreed to Rush Price). Two new search filters
  (Rush, Awaiting Parts).
- Part Order form: statusbar with the 4 transitions + Cancel; notes +
  photos notebook tabs; full chatter for audit.
- Menus: 'Parts to Order' under root; 'Emergency Surcharges' under
  Configuration.

SECURITY
- 8 new ACL entries (emergency_charge user/manager; part_order
  user/dispatcher/manager/technician; visit_report partline for office
  and field tech). Office sees parts but only managers can edit
  emergency rates.

Verified end-to-end on local westin-v19 - all 4 scenarios green:
  S1 Same-day rush stairlift -> $250 surcharge, ack stamped, squeeze
     assigned garry@ at first free 1h slot today, alert email queued,
     chatter posted.
  S2 Next-day priority bed -> $0 surcharge (no rate seeded for bed
     next_day - office can configure), 4 emails queued (client + office).
  S3 2-tech weekend stairlift -> $675 (450 base + 0.5x base for 2nd tech).
  S4 Parts-needed visit-report -> 2 PART-#### records created, repair
     awaiting_parts=True, ETA=2026-06-06, office activity scheduled,
     client email sent. Marking part ordered -> client mail. Marking
     all parts received -> auto-dispatch follow-up + client mail.

Bumped to 19.0.1.9.1.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 01:28:13 -04:00

136 lines
7.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_repair_intake_wizard_form" model="ir.ui.view">
<field name="name">fusion.repair.intake.wizard.form</field>
<field name="model">fusion.repair.intake.wizard</field>
<field name="arch" type="xml">
<form string="New Service Call">
<sheet>
<group>
<group string="Caller / Client">
<field name="intake_user_id" options="{'no_create': True}"/>
<field name="partner_id"
options="{'no_create_edit': False, 'no_quick_create': False}"/>
<field name="partner_phone" readonly="1" invisible="not partner_id"/>
</group>
</group>
<!-- C1: duplicate-call detection banner -->
<div class="alert alert-warning d-flex justify-content-between align-items-center"
role="alert"
invisible="duplicate_count == 0">
<div>
<i class="fa fa-exclamation-triangle me-1"/>
<strong>Open repair already exists for this client</strong>
(<field name="duplicate_count" nolabel="1" readonly="1" class="d-inline"/>
in last <field name="duplicate_window_days" nolabel="1" readonly="1" class="d-inline"/> days).
Consider adding a note to the existing repair instead.
</div>
<button name="action_open_existing_repair"
type="object"
string="Open Existing Repair"
class="btn btn-sm btn-warning"/>
</div>
<field name="duplicate_repair_ids" invisible="1"/>
<field name="currency_id" invisible="1"/>
<!-- C5: outstanding-balance warning banner -->
<div class="alert alert-danger d-flex justify-content-between align-items-center"
role="alert"
invisible="not show_outstanding_warning">
<div>
<i class="fa fa-money me-1"/>
<strong>Outstanding balance:</strong>
<field name="outstanding_balance" widget="monetary" nolabel="1" readonly="1" class="d-inline"/>
across <field name="outstanding_invoice_count" nolabel="1" readonly="1" class="d-inline"/> invoice(s).
Worth mentioning during this call.
</div>
<button name="action_view_outstanding_invoices"
type="object"
string="View Invoices"
class="btn btn-sm btn-danger"/>
</div>
<separator string="Equipment Items (one repair per item)"/>
<field name="equipment_ids">
<list editable="bottom">
<field name="sequence" widget="handle"/>
<field name="repair_category_id" options="{'no_create': True}"/>
<field name="product_id" optional="show"/>
<field name="lot_id" optional="hide"/>
<field name="third_party" optional="show"/>
<field name="urgency" widget="badge"
decoration-success="urgency == 'normal'"
decoration-warning="urgency == 'urgent'"
decoration-danger="urgency == 'safety'"/>
<field name="issue_summary"/>
<field name="scheduled_date" optional="hide"/>
</list>
<form>
<group>
<group>
<field name="repair_category_id" options="{'no_create': True}"/>
<field name="product_id"/>
<field name="lot_id"/>
<field name="third_party"/>
</group>
<group>
<field name="urgency"/>
<field name="scheduled_date"/>
<field name="intake_template_id" options="{'no_create': True}"/>
</group>
</group>
<field name="issue_summary"
placeholder="One-line summary (e.g. 'stairlift stops halfway up')"/>
<field name="issue_category"
placeholder="Symptom tag (e.g. battery, motor, remote)"/>
<field name="internal_notes" placeholder="Internal notes"/>
<separator string="Photos / Videos"/>
<field name="photo_ids" widget="many2many_binary"/>
</form>
</field>
<!-- C6: quote-only mode -->
<separator string="Options"/>
<group>
<field name="quote_only"/>
</group>
<!-- Bundle 8: rush / emergency surcharge -->
<separator string="Rush / Emergency Service"/>
<group>
<field name="rush_requested"/>
<field name="rush_tier"
required="rush_requested"
invisible="not rush_requested"/>
<field name="rush_techs_required"
invisible="not rush_requested"/>
<field name="rush_surcharge_preview"
widget="monetary"
readonly="1"
invisible="not rush_requested"/>
<field name="currency_id" invisible="1"/>
<field name="rush_acknowledged"
invisible="not rush_requested"/>
</group>
<div class="alert alert-warning"
role="alert"
invisible="not rush_requested or rush_acknowledged">
<i class="fa fa-exclamation-triangle me-1"/>
<strong>Read the surcharge to the client and get verbal OK.</strong>
Then tick the "Client Agreed to Price" box above before submitting.
</div>
</sheet>
<footer>
<button string="Submit"
name="action_submit"
type="object"
class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
</odoo>