feat(fusion_repairs): Phase 1 MVP - backend intake wizard + core models

Scaffolds the fusion_repairs module that extends Odoo 19 repair.order with
a guided medical-equipment intake workflow.

Models
- fusion.repair.product.category (8 medical equipment categories seeded)
- fusion.repair.intake.template / .question / .answer (7 templates,
  32 questions seeded across hospital bed, stairlift, porch lift,
  wheelchair, walker/rollator, mattress)
- fusion.repair.intake.service (AbstractModel) - single entry point used
  by backend wizard, sales rep portal, and public client portal so all
  three surfaces produce identical outcomes
- repair.order extensions (x_fc_intake_*, x_fc_third_party_equipment,
  x_fc_photo_ids, x_fc_urgency, x_fc_estimated/actual_cost, AI summary)
- fusion.technician.task back-link (x_fc_repair_order_id)
- res.partner service preferences (preferred tech, time window, access notes)
- res.users repair extensions (skills, cost rate, on-call rotation fields)
- res.config.settings for variance thresholds, portal URL, rate limit

UI
- Backend intake wizard with multi-equipment loop, third-party flag, photos
- repair.order form: Intake tab, Photos, Pricing tab, AI tab, smart buttons
  (technician tasks, intake answers, original SO)
- Kanban + list view urgency badges
- Fusion Repairs app menu (New Service Call, Repair Orders, Config)

Activities & Email
- 4 follow-up activity types (CS callback, tech dispatch, visit follow-up,
  manager review) with urgency-tiered deadlines
- 2 mail templates (client confirmation + office notification) with the
  same dark/light-safe styling as fusion_claims ADP templates

Security
- New res.groups.privilege + 3 groups (User, Dispatcher, Manager)
- Reuses fusion_tasks.group_field_technician (do NOT recreate)
- Reuses fusion_authorizer_portal.group_sales_rep_portal
- Multi-company global rule + technician scoping rule on repair.order

Verified end-to-end on local westin-v19 dev DB via odoo-shell - creates
multiple repairs in one session, auto-creates dispatch task for urgent,
attaches 4 activity types correctly per urgency tier and third-party flag.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gsinghpal
2026-05-20 21:35:52 -04:00
parent 79fbfec61f
commit 429084e0bf
32 changed files with 2823 additions and 0 deletions

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Intake Template -->
<record id="view_repair_intake_template_list" model="ir.ui.view">
<field name="name">fusion.repair.intake.template.list</field>
<field name="model">fusion.repair.intake.template</field>
<field name="arch" type="xml">
<list string="Intake Templates">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="code"/>
<field name="question_count"/>
<field name="is_default"/>
<field name="active" widget="boolean_toggle"/>
</list>
</field>
</record>
<record id="view_repair_intake_template_form" model="ir.ui.view">
<field name="name">fusion.repair.intake.template.form</field>
<field name="model">fusion.repair.intake.template</field>
<field name="arch" type="xml">
<form string="Intake Template">
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" placeholder="e.g. Stairlift - Standard Intake"/>
</h1>
</div>
<group>
<group>
<field name="code"/>
<field name="sequence"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group>
<field name="is_default"/>
<field name="active"/>
</group>
</group>
<field name="product_category_ids" widget="many2many_tags"/>
<notebook>
<page string="Questions" name="questions">
<field name="question_ids">
<list editable="bottom">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="code" optional="hide"/>
<field name="question_type"/>
<field name="required"/>
<field name="help_text" optional="hide"/>
<field name="selection_options" optional="hide"/>
<field name="symptom_keywords" optional="hide"/>
</list>
<form>
<group>
<group>
<field name="name"/>
<field name="code"/>
<field name="question_type"/>
<field name="required"/>
</group>
<group>
<field name="sequence"/>
<field name="parent_question_id"/>
<field name="parent_answer_value"
invisible="not parent_question_id"/>
</group>
</group>
<field name="help_text" placeholder="Optional hint shown beneath the question"/>
<field name="selection_options"
invisible="question_type != 'selection'"
placeholder="One option per line"/>
<field name="symptom_keywords" placeholder="e.g. battery,charge,won't turn on"/>
</form>
</field>
</page>
<page string="Description" name="description">
<field name="description"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="action_repair_intake_template" model="ir.actions.act_window">
<field name="name">Intake Templates</field>
<field name="res_model">fusion.repair.intake.template</field>
<field name="view_mode">list,form</field>
</record>
</odoo>

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Top-level app menu -->
<menuitem id="menu_fusion_repairs_root"
name="Fusion Repairs"
sequence="48"
web_icon="fusion_repairs,static/description/icon.png"
groups="fusion_repairs.group_fusion_repairs_user"/>
<!-- Operations -->
<menuitem id="menu_fusion_repairs_operations"
name="Operations"
parent="menu_fusion_repairs_root"
sequence="10"/>
<menuitem id="menu_fusion_repairs_new_call"
name="New Service Call"
parent="menu_fusion_repairs_operations"
action="action_open_repair_intake_wizard"
sequence="10"/>
<menuitem id="menu_fusion_repairs_orders"
name="Repair Orders"
parent="menu_fusion_repairs_operations"
action="repair.action_repair_order_tree"
sequence="20"/>
<!-- Configuration -->
<menuitem id="menu_fusion_repairs_configuration"
name="Configuration"
parent="menu_fusion_repairs_root"
sequence="90"
groups="fusion_repairs.group_fusion_repairs_manager"/>
<menuitem id="menu_fusion_repairs_categories"
name="Equipment Categories"
parent="menu_fusion_repairs_configuration"
action="action_repair_product_category"
sequence="10"/>
<menuitem id="menu_fusion_repairs_intake_templates"
name="Intake Templates"
parent="menu_fusion_repairs_configuration"
action="action_repair_intake_template"
sequence="20"/>
</odoo>

View File

@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- ============================================================== -->
<!-- Form view extensions -->
<!-- ============================================================== -->
<record id="view_repair_order_form_inherit_fusion_repairs" model="ir.ui.view">
<field name="name">repair.order.form.inherit.fusion_repairs</field>
<field name="model">repair.order</field>
<field name="inherit_id" ref="repair.view_repair_order_form"/>
<field name="arch" type="xml">
<!-- Smart buttons: Technician Tasks + Intake Answers + Original SO. -->
<xpath expr="//div[hasclass('oe_button_box')]" position="inside">
<button name="action_view_technician_tasks"
type="object"
class="oe_stat_button"
icon="fa-wrench"
invisible="x_fc_technician_task_count == 0">
<field name="x_fc_technician_task_count" widget="statinfo" string="Tech Tasks"/>
</button>
<button name="action_view_intake_answers"
type="object"
class="oe_stat_button"
icon="fa-list-alt"
invisible="x_fc_intake_answer_count == 0">
<field name="x_fc_intake_answer_count" widget="statinfo" string="Answers"/>
</button>
<button name="action_view_original_sale_order"
type="object"
class="oe_stat_button"
icon="fa-dollar"
invisible="not x_fc_original_sale_order_id">
<field name="x_fc_original_sale_order_id" widget="statinfo" string="Original SO"/>
</button>
</xpath>
<!-- Add intake metadata under partner_id -->
<xpath expr="//field[@name='partner_id']" position="after">
<field name="x_fc_repair_category_id" options="{'no_create': True}"/>
<field name="x_fc_urgency" widget="badge"
decoration-success="x_fc_urgency == 'normal'"
decoration-warning="x_fc_urgency == 'urgent'"
decoration-danger="x_fc_urgency == 'safety'"/>
<field name="x_fc_third_party_equipment"/>
<field name="x_fc_intake_source" readonly="1"/>
<field name="x_fc_intake_user_id" readonly="1" invisible="not x_fc_intake_user_id"/>
<field name="x_fc_intake_session_id" readonly="1" invisible="not x_fc_intake_session_id"/>
</xpath>
<!-- Add a Fusion Repairs notebook tab with intake + photos. -->
<xpath expr="//notebook" position="inside">
<page string="Intake" name="fusion_intake">
<group>
<group>
<field name="x_fc_intake_template_id" readonly="1"/>
<field name="x_fc_issue_category"/>
</group>
<group>
<field name="x_fc_warranty_override_reason"
placeholder="Reason if warranty status was overridden"/>
<field name="x_fc_estimated_duration" widget="float_time"/>
</group>
</group>
<separator string="Answers"/>
<field name="x_fc_intake_answer_ids" readonly="1">
<list>
<field name="sequence" column_invisible="True"/>
<field name="question_name"/>
<field name="value_display"/>
<field name="question_type" optional="hide"/>
</list>
</field>
<separator string="Photos &amp; Videos"/>
<field name="x_fc_photo_ids" widget="many2many_binary"/>
</page>
<page string="Pricing" name="fusion_pricing" invisible="not x_fc_estimated_cost and not x_fc_actual_cost">
<group>
<group>
<field name="x_fc_estimated_cost" widget="monetary"/>
<field name="x_fc_actual_cost" widget="monetary"/>
</group>
<group>
<field name="x_fc_cost_variance_pct" widget="float" digits="[16,2]"/>
<field name="x_fc_requires_requote"/>
<field name="company_currency_id" invisible="1"/>
</group>
</group>
</page>
<page string="AI Brief" name="fusion_ai" invisible="not x_fc_ai_summary">
<field name="x_fc_ai_summary" readonly="1"/>
</page>
</xpath>
</field>
</record>
<!-- ============================================================== -->
<!-- Kanban: add urgency badge + intake source -->
<!-- ============================================================== -->
<record id="view_repair_order_kanban_inherit_fusion_repairs" model="ir.ui.view">
<field name="name">repair.order.kanban.inherit.fusion_repairs</field>
<field name="model">repair.order</field>
<field name="inherit_id" ref="repair.view_repair_kanban"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="x_fc_urgency"/>
<field name="x_fc_third_party_equipment"/>
</xpath>
</field>
</record>
<!-- ============================================================== -->
<!-- List: add urgency + source columns -->
<!-- ============================================================== -->
<record id="view_repair_order_list_inherit_fusion_repairs" model="ir.ui.view">
<field name="name">repair.order.list.inherit.fusion_repairs</field>
<field name="model">repair.order</field>
<field name="inherit_id" ref="repair.view_repair_order_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="x_fc_urgency" widget="badge"
decoration-success="x_fc_urgency == 'normal'"
decoration-warning="x_fc_urgency == 'urgent'"
decoration-danger="x_fc_urgency == 'safety'"
optional="show"/>
<field name="x_fc_intake_source" optional="hide"/>
<field name="x_fc_third_party_equipment" optional="hide"/>
</xpath>
</field>
</record>
<!-- ============================================================== -->
<!-- New Service Call action - opens the wizard -->
<!-- ============================================================== -->
<record id="action_open_repair_intake_wizard" model="ir.actions.act_window">
<field name="name">New Service Call</field>
<field name="res_model">fusion.repair.intake.wizard</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_repair_product_category_list" model="ir.ui.view">
<field name="name">fusion.repair.product.category.list</field>
<field name="model">fusion.repair.product.category</field>
<field name="arch" type="xml">
<list string="Repair Categories">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="code"/>
<field name="safety_critical"/>
<field name="intake_template_id"/>
<field name="active" widget="boolean_toggle"/>
</list>
</field>
</record>
<record id="view_repair_product_category_form" model="ir.ui.view">
<field name="name">fusion.repair.product.category.form</field>
<field name="model">fusion.repair.product.category</field>
<field name="arch" type="xml">
<form string="Repair Category">
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" placeholder="e.g. Stairlift"/>
</h1>
</div>
<group>
<group>
<field name="code" placeholder="e.g. stairlift"/>
<field name="sequence"/>
<field name="icon"/>
</group>
<group>
<field name="safety_critical"/>
<field name="intake_template_id"/>
<field name="active"/>
</group>
</group>
<field name="description" placeholder="Describe what equipment falls into this category..."/>
</sheet>
</form>
</field>
</record>
<record id="action_repair_product_category" model="ir.actions.act_window">
<field name="name">Equipment Categories</field>
<field name="res_model">fusion.repair.product.category</field>
<field name="view_mode">list,form</field>
</record>
</odoo>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form_inherit_fusion_repairs" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.fusion_repairs</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//form" position="inside">
<app data-string="Fusion Repairs"
string="Fusion Repairs"
name="fusion_repairs"
groups="fusion_repairs.group_fusion_repairs_manager">
<block title="Notifications" name="fc_repairs_notifications">
<setting id="fc_repairs_enable_email_notifications"
string="Enable Email Notifications"
help="Master toggle for all automated repair-related emails (intake confirmations, dispatch alerts, office digests).">
<field name="fc_repairs_enable_email_notifications"/>
</setting>
</block>
<block title="Intake Behaviour" name="fc_repairs_intake">
<setting id="fc_repairs_duplicate_call_window_days"
string="Duplicate Call Window (days)"
help="When an intake matches an open repair from this many days back on the same phone, the wizard offers 'add note instead'.">
<field name="fc_repairs_duplicate_call_window_days"/>
</setting>
<setting id="fc_repairs_outstanding_balance_threshold"
string="Outstanding Balance Warning ($)"
help="Show a warning if the client's open invoice total exceeds this amount.">
<field name="fc_repairs_outstanding_balance_threshold"/>
</setting>
</block>
<block title="Pricing Variance" name="fc_repairs_pricing">
<setting id="fc_repairs_variance_threshold_pct"
string="Variance Threshold (%)"
help="If the actual repair cost exceeds the estimate by more than this percentage, invoicing is blocked until manager review.">
<field name="fc_repairs_variance_threshold_pct"/>
</setting>
<setting id="fc_repairs_variance_threshold_amount"
string="Variance Threshold ($)"
help="Absolute variance amount that also triggers re-quote (whichever hits first).">
<field name="fc_repairs_variance_threshold_amount"/>
</setting>
</block>
<block title="Public Client Portal" name="fc_repairs_client_portal">
<setting id="fc_repairs_client_portal_url"
string="Portal URL Path"
help="URL path mentioned in voicemail greetings and printed on QR stickers. Phase 1 ships the form at this path.">
<field name="fc_repairs_client_portal_url"/>
</setting>
<setting id="fc_repairs_client_portal_rate_limit_per_hour"
string="Rate Limit (per hour per IP)"
help="Anti-spam limit for the public form.">
<field name="fc_repairs_client_portal_rate_limit_per_hour"/>
</setting>
</block>
</app>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_res_partner_form_inherit_fusion_repairs" model="ir.ui.view">
<field name="name">res.partner.form.inherit.fusion_repairs</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Service Preferences" name="fusion_repairs_prefs"
groups="fusion_repairs.group_fusion_repairs_user">
<group>
<group>
<field name="x_fc_preferred_tech_id" options="{'no_create': True}"/>
<field name="x_fc_preferred_window"/>
</group>
<group>
<field name="x_fc_repair_count" readonly="1"/>
</group>
</group>
<separator string="Access Notes for Technicians"/>
<field name="x_fc_access_notes"
placeholder="e.g. Dog in front yard, use side door, gate code 1234"/>
</page>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_res_users_form_inherit_fusion_repairs" model="ir.ui.view">
<field name="name">res.users.form.inherit.fusion_repairs</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Repairs" name="fusion_repairs_user"
groups="fusion_repairs.group_fusion_repairs_manager">
<group>
<group string="Skills &amp; Costing">
<field name="x_fc_repair_skills" widget="many2many_tags"
options="{'no_create': True}"/>
<field name="x_fc_tech_cost_rate" widget="monetary"/>
<field name="company_currency_id" invisible="1"/>
</group>
<group string="On-Call Rotation">
<field name="x_fc_on_call"/>
<field name="x_fc_on_call_priority"
invisible="not x_fc_on_call"/>
<field name="x_fc_on_call_phone"
invisible="not x_fc_on_call"
placeholder="Leave blank to use partner phone"/>
</group>
</group>
</page>
</xpath>
</field>
</record>
</odoo>