Files
famlaw/activeblue_familylaw/views/fl_discovery_suggest_views.xml
Carlos Garcia 928568374e Add complexity-driven discovery suggestion wizard
fl_discovery_suggest_wizard.py:
  - fl.discovery.suggest.wizard: reads case complexity (AI analysis or
    rule-based fallback), case type, issue_tag_ids, and flags
    (domestic_violence_flag, respondent_has_counsel, income_imputation_concern)
    to build a pre-checked list of relevant discovery items
  - fl.discovery.suggest.line: one row per suggested item with type,
    directed_to, description, rationale, trigger badge, and min complexity
  - 50+ templates across 10 trigger categories: base, modification,
    dissolution, paternity, alimony, custody, imputation (Barner v. Barner),
    self_employment, domestic_violence, respondent_counsel, complex_only
  - action_create_selected: creates fl.discovery records (draft) and posts
    a chatter summary with all created items; bound to fl.case form

fl_case.py:
  - Add issue_tag_ids Many2many(fl.issue.tag) — field referenced by AI
    engine rule-tagging but not previously declared on the model

fl_discovery_suggest_views.xml:
  - Wizard form: complexity badge, alert box explaining level, editable
    suggestion list with trigger/type/description/rationale columns
  - Action bound to fl.case form via binding_model_id
  - Inherits fl.case form to add issue_tag_ids widget to AI tab

ir.model.access.csv: access rows for both new wizard models

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 00:50:07 -05:00

130 lines
7.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- Discovery Suggestion Wizard views
Opened from the fl.case form (action button) or Cases menu.
Reads case complexity, issue tags, and flags to pre-populate a
checklist of relevant fl.discovery items for review.
-->
<odoo>
<data>
<!-- ══════════════════════════════════════════════════════════════
Wizard form view
══════════════════════════════════════════════════════════════ -->
<record id="view_fl_discovery_suggest_wizard_form" model="ir.ui.view">
<field name="name">fl.discovery.suggest.wizard.form</field>
<field name="model">fl.discovery.suggest.wizard</field>
<field name="arch" type="xml">
<form string="Discovery Suggestions">
<sheet>
<div class="oe_title">
<h1>Suggested Discovery Items</h1>
</div>
<!-- Case + Complexity header -->
<group>
<group>
<field name="case_id" readonly="1"/>
</group>
<group>
<field name="complexity" readonly="1" widget="badge"
decoration-success="complexity == 'simple'"
decoration-warning="complexity == 'moderate'"
decoration-danger="complexity == 'complex'"/>
<field name="complexity_source" readonly="1" string="Source"/>
<field name="selected_count" readonly="1" string="Items Selected"/>
</group>
</group>
<!-- Complexity explanation -->
<div class="alert alert-success mb-0"
invisible="complexity != 'simple'">
<strong>Simple case</strong> — core financial disclosure items only.
Run an AI analysis to check for additional complexity factors.
</div>
<div class="alert alert-warning mb-0"
invisible="complexity != 'moderate'">
<strong>Moderate complexity</strong> — standard income discovery +
targeted items based on case flags.
Items marked "Moderate" minimum are included.
</div>
<div class="alert alert-danger mb-0"
invisible="complexity != 'complex'">
<strong>Complex case</strong> — full discovery suite including employer
subpoenas, bank subpoenas, and deposition.
</div>
<div class="alert alert-info mt-2">
<strong>Review and deselect</strong> any items that don't apply.
Click <em>Create Selected</em> to add them to the case as draft
discovery items. Items are not served until you mark them "Served."
</div>
<!-- Suggestion lines -->
<field name="line_ids" nolabel="1">
<list editable="bottom" decoration-muted="not selected">
<field name="selected" widget="boolean_toggle" optional="show"/>
<field name="trigger_label" string="Trigger"
widget="badge" optional="show"/>
<field name="discovery_type" optional="show"/>
<field name="directed_to" optional="show"/>
<field name="description"/>
<field name="rationale" optional="hide"/>
<field name="complexity_label" string="Min. Level"
optional="hide"/>
<field name="sequence" optional="hide"/>
</list>
</field>
</sheet>
<footer>
<button name="action_create_selected"
string="Create Selected Discovery Items"
type="object" class="btn-primary"
invisible="selected_count == 0"/>
<button name="action_populate"
string="Re-generate Suggestions"
type="object" class="btn-secondary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<!-- ══════════════════════════════════════════════════════════════
Action — opened from fl.case form
══════════════════════════════════════════════════════════════ -->
<record id="action_fl_discovery_suggest_wizard" model="ir.actions.act_window">
<field name="name">Suggest Discovery Items</field>
<field name="res_model">fl.discovery.suggest.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>
<!-- ══════════════════════════════════════════════════════════════
Add issue_tag_ids widget to fl.case form — AI tab
══════════════════════════════════════════════════════════════ -->
<record id="view_fl_case_issue_tags_inherit" model="ir.ui.view">
<field name="name">fl.case.form.issue.tags</field>
<field name="model">fl.case</field>
<field name="inherit_id" ref="activeblue_familylaw.view_fl_case_form"/>
<field name="arch" type="xml">
<!-- Add issue_tag_ids to the AI Analysis tab -->
<xpath expr="//page[@name='ai']//group[1]" position="after">
<group>
<field name="issue_tag_ids" widget="many2many_tags"
options="{'color_field': 'color'}"
string="Issue Tags (auto-tagged by AI)"/>
</group>
</xpath>
</field>
</record>
</data>
</odoo>