Files
famlaw/activeblue_familylaw/views/fl_analysis_views.xml
tocmo0nlord 465c049251 Add Attorney AI agent (substantive strategy memo)
- fl.attorney.agent (AbstractModel): manual-only substantive analysis fired from
  the case AI tab. Builds a full case context (parties, children, financials,
  issue tags, prior analyses) plus candidate statute/caselaw lists, and asks
  Claude to author a strategy memo, draft arguments/counterarguments, write a
  risk narrative, and assess substantial change (FL 61.30(1)(b))
- Grounds output in the real library: the model may only pick statutes/case law
  from the supplied candidates, which are then resolved back to records and
  linked (fl.analysis.cited_statute_ids / matched_caselaw_ids, case.caselaw_ids)
- Rule-based fallback produces a usable memo (complexity, statutes by category,
  caselaw by tag, risk flags) when the API is unavailable — never a raw error
- fl.analysis: add analysis_type, strategy_memo (Html), risk_narrative,
  cited_statute_ids; surface them in the analysis views
- fl.case: add attorney_memo_id + related memo/risk display; action_run_attorney_agent
  opens the memo; "Generate Attorney Strategy Memo" button on the AI tab (admin)
- Refactor fl_ai_engine: extract shared call_claude_json(system, user) +
  _extract_json so both agents and the engine share one Claude/JSON path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 00:12:20 +00:00

72 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_fl_analysis_tree" model="ir.ui.view">
<field name="name">fl.analysis.tree</field>
<field name="model">fl.analysis</field>
<field name="arch" type="xml">
<tree string="AI Analyses">
<field name="case_id"/>
<field name="analysis_type"/>
<field name="analysis_date"/>
<field name="model_used"/>
<field name="attorney_referral_flag"/>
<field name="confidence_level"/>
<field name="case_complexity"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="view_fl_analysis_form" model="ir.ui.view">
<field name="name">fl.analysis.form</field>
<field name="model">fl.analysis</field>
<field name="arch" type="xml">
<form string="AI Case Analysis">
<sheet>
<group>
<group>
<field name="case_id"/>
<field name="analysis_type"/>
<field name="analysis_date"/>
<field name="model_used"/>
<field name="state"/>
</group>
<group>
<field name="attorney_referral_flag"/>
<field name="confidence_level"/>
<field name="case_complexity"/>
</group>
</group>
<div class="alert alert-danger" role="alert"
attrs="{'invisible': [('attorney_referral_flag', '=', False)]}">
<strong>⚠️ ATTORNEY REFERRAL RECOMMENDED</strong><br/>
<field name="attorney_referral_reason" readonly="1" nolabel="1"/>
</div>
<separator string="Strategy Memo"
attrs="{'invisible': [('analysis_type', '!=', 'attorney')]}"/>
<field name="strategy_memo" widget="html" readonly="1" nolabel="1"
attrs="{'invisible': [('analysis_type', '!=', 'attorney')]}"/>
<separator string="Risk Narrative"
attrs="{'invisible': [('risk_narrative', '=', False)]}"/>
<field name="risk_narrative" readonly="1" nolabel="1"
attrs="{'invisible': [('risk_narrative', '=', False)]}"/>
<separator string="Plain English Summary (English)"/>
<field name="plain_english_summary" readonly="1" nolabel="1"/>
<separator string="Plain English Summary (Español)"/>
<field name="plain_english_summary_es" readonly="1" nolabel="1"/>
<separator string="Cited Statutes"
attrs="{'invisible': [('cited_statute_ids', '=', [])]}"/>
<field name="cited_statute_ids" widget="many2many_tags" readonly="1" nolabel="1"
attrs="{'invisible': [('cited_statute_ids', '=', [])]}"/>
<separator string="Matched Case Law"/>
<field name="matched_caselaw_ids" widget="many2many_tags" readonly="1" nolabel="1"/>
</sheet>
</form>
</field>
</record>
</data>
</odoo>