Add conflict-of-interest check engine; gate stage advancement at Intake
- New fl.conflict.check model: screens petitioner/respondent/party_ids names against parties on other open cases (exact partner match + difflib fuzzy match at 0.85 threshold); skips folded/closed stages - Runs automatically as the first action in fl.case.create; logs conflicts to chatter with matched-case detail and never silently passes - fl.case gains conflict_check_passed/conflict_check_id/conflict_check_ids; write() blocks advancing stage_id past Intake until the check passes - Admin-only action_override requires a written justification, stamps user/date, and flips conflict_check_passed True with a chatter audit entry - Add conflict check form/tree/search views, action, Cases sub-menu item, case form banner + Run Conflict Check button, and Kanban conflict badge - ACL entries for fl.conflict.check (admin full, paralegal no-delete) - Finish Claude migration cleanup in fl_analysis.py (model_used default, docstring/help text) - Add .gitignore for Python artifacts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
119
activeblue_familylaw/views/fl_conflict_check_views.xml
Normal file
119
activeblue_familylaw/views/fl_conflict_check_views.xml
Normal file
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- ══════════════════════════════════════════════════════
|
||||
FORM VIEW
|
||||
══════════════════════════════════════════════════════ -->
|
||||
<record id="view_fl_conflict_check_form" model="ir.ui.view">
|
||||
<field name="name">fl.conflict.check.form</field>
|
||||
<field name="model">fl.conflict.check</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Conflict of Interest Check">
|
||||
<header>
|
||||
<button name="action_override" string="Override Conflict"
|
||||
type="object" class="oe_highlight"
|
||||
confirm="Override this conflict of interest? This allows the case to advance past Intake. A justification is required."
|
||||
attrs="{'invisible': [('status', '!=', 'conflict')]}"
|
||||
groups="activeblue_familylaw.group_admin"/>
|
||||
<field name="status" widget="statusbar"
|
||||
statusbar_visible="clear,conflict,override"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="alert alert-success" role="alert"
|
||||
attrs="{'invisible': [('status', '!=', 'clear')]}">
|
||||
<strong>✅ CLEAR</strong> — No conflicting parties found on other open cases.
|
||||
</div>
|
||||
<div class="alert alert-danger" role="alert"
|
||||
attrs="{'invisible': [('status', '!=', 'conflict')]}">
|
||||
<strong>🚩 CONFLICT DETECTED</strong> — One or more parties match
|
||||
parties on other open cases. The case cannot advance past Intake
|
||||
until this is overridden by an administrator.
|
||||
</div>
|
||||
<div class="alert alert-warning" role="alert"
|
||||
attrs="{'invisible': [('status', '!=', 'override')]}">
|
||||
<strong>⚠ OVERRIDDEN</strong> — This conflict was overridden by
|
||||
<field name="override_user_id" readonly="1" nolabel="1" class="oe_inline"/>
|
||||
on <field name="override_date" readonly="1" nolabel="1" class="oe_inline"/>.
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="case_id"/>
|
||||
<field name="check_date"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="matched_case_ids" widget="many2many_tags"
|
||||
attrs="{'invisible': [('matched_case_ids', '=', [])]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator string="Match Detail"/>
|
||||
<field name="match_detail" nolabel="1" readonly="1"/>
|
||||
<separator string="Override Justification"
|
||||
attrs="{'invisible': [('status', '=', 'clear')]}"/>
|
||||
<field name="override_justification" nolabel="1"
|
||||
placeholder="Required to override a conflict — explain why the firm may proceed despite the match."
|
||||
attrs="{'invisible': [('status', '=', 'clear')], 'readonly': [('status', '=', 'override')]}"/>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids"/>
|
||||
<field name="message_ids"/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ══════════════════════════════════════════════════════
|
||||
TREE VIEW
|
||||
══════════════════════════════════════════════════════ -->
|
||||
<record id="view_fl_conflict_check_tree" model="ir.ui.view">
|
||||
<field name="name">fl.conflict.check.tree</field>
|
||||
<field name="model">fl.conflict.check</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Conflict Checks"
|
||||
decoration-danger="status == 'conflict'"
|
||||
decoration-warning="status == 'override'"
|
||||
decoration-success="status == 'clear'">
|
||||
<field name="case_id"/>
|
||||
<field name="check_date"/>
|
||||
<field name="status"/>
|
||||
<field name="matched_case_ids" widget="many2many_tags"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ══════════════════════════════════════════════════════
|
||||
SEARCH VIEW
|
||||
══════════════════════════════════════════════════════ -->
|
||||
<record id="view_fl_conflict_check_search" model="ir.ui.view">
|
||||
<field name="name">fl.conflict.check.search</field>
|
||||
<field name="model">fl.conflict.check</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Conflict Checks">
|
||||
<field name="case_id"/>
|
||||
<filter string="Conflicts" name="conflicts"
|
||||
domain="[('status', '=', 'conflict')]"/>
|
||||
<filter string="Overridden" name="overridden"
|
||||
domain="[('status', '=', 'override')]"/>
|
||||
<filter string="Clear" name="clear"
|
||||
domain="[('status', '=', 'clear')]"/>
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="Status" name="group_status"
|
||||
context="{'group_by': 'status'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ══════════════════════════════════════════════════════
|
||||
ACTION
|
||||
══════════════════════════════════════════════════════ -->
|
||||
<record id="action_fl_conflict_check_list" model="ir.actions.act_window">
|
||||
<field name="name">Conflict Checks</field>
|
||||
<field name="res_model">fl.conflict.check</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_fl_conflict_check_search"/>
|
||||
<field name="context">{'search_default_conflicts': 1}</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user