Phase 7: full wizards, auto-generated case tasks, config parameters

fl_intake_wizard.py:
  - Full multi-step intake: parties, income, children, DV flag, fee
    waiver, AI analysis option
  - Creates res.partner → fl.party → fl.case chain (mirrors portal)
  - Triggers fee waiver record creation and Ollama AI analysis
  - Residency warning computed field (FL 61.021 — 6-month check)

fl_generate_packet_wizard.py:
  - Generates selected documents as PDFs via _render_qweb_pdf
  - Handles 4 binding models: fl.case, fl.party, fl.fee.waiver,
    fl.support.calculation, fl.income.withholding
  - Attaches generated PDFs to case chatter with summary note
  - Bound to fl.case form as an action button

fl_analysis_wizard.py:
  - Checks for recent analysis (<24h) before running new one
  - force_reanalysis flag bypasses the lock
  - Shows last analysis age label in form; opens result as dialog
  - Bound to fl.case form as an action button

fl_case.py:
  - _CASE_TASK_TEMPLATES: standard task lists for 6 case types
  - _generate_case_tasks(): creates project.task records from templates
  - Called automatically from _create_case_project on case creation

fl_wizard_views.xml:
  - Form views for all 3 wizards with inline help text
  - Packet wizard bound to fl.case form via binding_model_id

data/case_task_templates.xml:
  - ir.config_parameter records for Ollama URL, model, deadline days,
    mandatory disclosure days, AI lockout hours — all admin-configurable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-05-06 23:49:10 -05:00
parent 6dc2144db7
commit 26f58952b4
7 changed files with 1006 additions and 60 deletions

View File

@@ -0,0 +1,248 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Wizard form views:
- fl.intake.wizard → New Case Intake
- fl.generate.packet.wizard → Generate Filing Packet
- fl.analysis.wizard → Trigger AI Analysis
-->
<odoo>
<data>
<!-- ══════════════════════════════════════════════════════════════
FL Intake Wizard
══════════════════════════════════════════════════════════════ -->
<record id="view_fl_intake_wizard_form" model="ir.ui.view">
<field name="name">fl.intake.wizard.form</field>
<field name="model">fl.intake.wizard</field>
<field name="arch" type="xml">
<form string="New Case Intake">
<sheet>
<div class="oe_title">
<h1>New Family Law Case</h1>
</div>
<!-- Step 1: Case Identity -->
<group string="Step 1 — Case Information">
<group>
<field name="case_type" widget="selection"/>
<field name="court_case_number"
placeholder="Leave blank if not yet assigned"/>
</group>
</group>
<!-- Step 2: Parties -->
<group string="Step 2 — Parties">
<group string="Petitioner">
<field name="petitioner_name" required="1"/>
<field name="petitioner_email"/>
<field name="petitioner_phone"/>
<field name="petitioner_address"/>
<field name="petitioner_city"/>
<field name="petitioner_fl_resident_since"/>
<field name="residency_warning" readonly="1"
invisible="not petitioner_fl_resident_since"/>
</group>
<group string="Respondent">
<field name="respondent_name"/>
<field name="respondent_has_counsel"/>
</group>
</group>
<!-- Step 3: Children & Safety -->
<group string="Step 3 — Children &amp; Safety">
<group>
<field name="num_children"/>
<field name="domestic_violence_flag"/>
<field name="income_imputation_concern"/>
</group>
</group>
<!-- DV Warning -->
<div class="alert alert-danger"
invisible="not domestic_violence_flag">
<strong>⚠ Domestic Violence — Attorney Referral Required</strong><br/>
Separate mediation rooms are mandatory (FL 44.102).
Pro se representation is strongly discouraged.
Resources: Legal Services of Greater Miami (305) 576-0080 |
Safespace: (305) 536-5565 | National Hotline: 1-800-799-7233
</div>
<!-- Step 4: Financial Information -->
<group string="Step 4 — Financial Information">
<group>
<field name="petitioner_monthly_gross"
string="Petitioner Monthly Gross Income ($)"/>
<field name="respondent_monthly_gross"
string="Respondent Monthly Gross Income ($)"/>
<field name="current_order_amount"
string="Current Support Order ($/month)"/>
<field name="household_size"/>
</group>
</group>
<!-- Step 5: Options -->
<group string="Step 5 — Options">
<group>
<field name="fee_waiver_request"/>
<field name="run_ai_analysis"/>
</group>
</group>
<group>
<field name="notes" widget="text" nolabel="1"
placeholder="Additional notes or case summary…"/>
</group>
</sheet>
<footer>
<button name="action_create_case" string="Create Case"
type="object" class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_fl_intake_wizard" model="ir.actions.act_window">
<field name="name">New Case Intake</field>
<field name="res_model">fl.intake.wizard</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<!-- ══════════════════════════════════════════════════════════════
Generate Filing Packet Wizard
══════════════════════════════════════════════════════════════ -->
<record id="view_fl_generate_packet_wizard_form" model="ir.ui.view">
<field name="name">fl.generate.packet.wizard.form</field>
<field name="model">fl.generate.packet.wizard</field>
<field name="arch" type="xml">
<form string="Generate Filing Packet">
<sheet>
<div class="oe_title">
<h1>Generate Filing Packet</h1>
</div>
<group>
<field name="case_id" readonly="1"/>
</group>
<group string="Select Documents to Include">
<group string="Case Documents">
<field name="include_mandatory_disclosure"/>
<field name="include_motion_to_modify"/>
<field name="include_default_motion"/>
<field name="include_parenting_plan"/>
</group>
<group string="Financial Documents">
<field name="include_financial_affidavit_short"/>
<field name="include_financial_affidavit_long"/>
<field name="include_support_worksheet"/>
<field name="include_notice_ssn"/>
<field name="include_fee_waiver"/>
<field name="include_income_withholding"/>
</group>
</group>
<div class="alert alert-info">
<strong>Note:</strong> Generated PDFs will be attached to the case
chatter and available for download. Documents that require related
records (e.g. a completed Support Calculation or Fee Waiver) will
be skipped if those records don't yet exist on the case.
</div>
<group>
<field name="attach_to_case"/>
</group>
</sheet>
<footer>
<button name="action_generate" string="Generate PDFs"
type="object" class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_fl_generate_packet_wizard" model="ir.actions.act_window">
<field name="name">Generate Filing Packet</field>
<field name="res_model">fl.generate.packet.wizard</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="binding_model_id" ref="model_fl_case"/>
<field name="binding_view_types">form</field>
<field name="context">{'active_id': active_id}</field>
</record>
<!-- ══════════════════════════════════════════════════════════════
AI Analysis Wizard
══════════════════════════════════════════════════════════════ -->
<record id="view_fl_analysis_wizard_form" model="ir.ui.view">
<field name="name">fl.analysis.wizard.form</field>
<field name="model">fl.analysis.wizard</field>
<field name="arch" type="xml">
<form string="Run AI Case Analysis">
<sheet>
<div class="oe_title">
<h1>AI Case Analysis</h1>
<h3>Powered by Ollama / LLaMA 3.1</h3>
</div>
<group>
<field name="case_id" readonly="1"/>
</group>
<!-- Recent analysis info -->
<group string="Previous Analysis">
<field name="recent_analysis_id" readonly="1"/>
<field name="recent_analysis_age_label" readonly="1"
string="Last Run"/>
</group>
<!-- Warning when recent analysis exists -->
<div class="alert alert-warning"
invisible="not has_recent or force_reanalysis">
<strong>⚠ Recent analysis found</strong> (<field name="recent_analysis_age_label" readonly="1" nolabel="1"/>).
Clicking "Run Analysis" will open the existing result.
Enable "Force Re-analysis" to generate a fresh one.
</div>
<group>
<field name="force_reanalysis"/>
<field name="has_recent" invisible="1"/>
</group>
<div class="alert alert-info">
<strong>What this does:</strong>
The AI engine analyzes the case data against Florida Family Law rules,
matches relevant case law, and produces a plain-English summary with
attorney referral recommendation. Analysis takes 3090 seconds.
</div>
</sheet>
<footer>
<button name="action_run_analysis" string="Run Analysis"
type="object" class="btn-primary"/>
<button name="action_view_recent" string="View Last Analysis"
type="object" class="btn-secondary"
invisible="not recent_analysis_id"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_fl_analysis_wizard" model="ir.actions.act_window">
<field name="name">Run AI Analysis</field>
<field name="res_model">fl.analysis.wizard</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="binding_model_id" ref="model_fl_case"/>
<field name="binding_view_types">form</field>
</record>
</data>
</odoo>