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:
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*.egg-info/
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.swp
|
||||||
@@ -55,6 +55,7 @@
|
|||||||
'views/fl_statute_views.xml',
|
'views/fl_statute_views.xml',
|
||||||
'views/fl_wizard_views.xml',
|
'views/fl_wizard_views.xml',
|
||||||
'views/fl_discovery_suggest_views.xml',
|
'views/fl_discovery_suggest_views.xml',
|
||||||
|
'views/fl_conflict_check_views.xml',
|
||||||
'views/menu_views.xml',
|
'views/menu_views.xml',
|
||||||
# Phase 4 — QWeb PDF Reports
|
# Phase 4 — QWeb PDF Reports
|
||||||
'report/report_financial_affidavit_short.xml',
|
'report/report_financial_affidavit_short.xml',
|
||||||
|
|||||||
@@ -15,3 +15,4 @@ from . import fl_analysis
|
|||||||
from . import fl_ai_engine
|
from . import fl_ai_engine
|
||||||
from . import fl_argument
|
from . import fl_argument
|
||||||
from . import fl_case
|
from . import fl_case
|
||||||
|
from . import fl_conflict_check
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ from odoo import fields, models
|
|||||||
|
|
||||||
|
|
||||||
class FlAnalysis(models.Model):
|
class FlAnalysis(models.Model):
|
||||||
"""
|
"""AI case analysis record. Written by the Claude API engine (fl.ai.engine)."""
|
||||||
Phase 5 — Full Ollama AI analysis implementation.
|
|
||||||
Phase 1: Stub with fields required by fl_case computed fields.
|
|
||||||
"""
|
|
||||||
_name = 'fl.analysis'
|
_name = 'fl.analysis'
|
||||||
_description = 'AI Case Analysis Result'
|
_description = 'AI Case Analysis Result'
|
||||||
_order = 'create_date desc'
|
_order = 'create_date desc'
|
||||||
@@ -19,7 +16,7 @@ class FlAnalysis(models.Model):
|
|||||||
)
|
)
|
||||||
model_used = fields.Char(
|
model_used = fields.Char(
|
||||||
string='AI Model',
|
string='AI Model',
|
||||||
default='llama3.1'
|
default='claude-sonnet-4-20250514'
|
||||||
)
|
)
|
||||||
|
|
||||||
# ── Results (referenced by fl_case related fields) ─────────────────────
|
# ── Results (referenced by fl_case related fields) ─────────────────────
|
||||||
@@ -67,7 +64,7 @@ class FlAnalysis(models.Model):
|
|||||||
], string='Case Complexity')
|
], string='Case Complexity')
|
||||||
raw_response = fields.Text(
|
raw_response = fields.Text(
|
||||||
string='Raw AI Response',
|
string='Raw AI Response',
|
||||||
help='Full JSON response from Ollama — for debugging'
|
help='Full JSON response from the Claude API — for debugging'
|
||||||
)
|
)
|
||||||
error_message = fields.Text(
|
error_message = fields.Text(
|
||||||
string='Error (if analysis failed)'
|
string='Error (if analysis failed)'
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
|
from odoo.exceptions import UserError
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
|
|
||||||
@@ -86,6 +87,23 @@ class FlCase(models.Model):
|
|||||||
)
|
)
|
||||||
active = fields.Boolean(default=True)
|
active = fields.Boolean(default=True)
|
||||||
|
|
||||||
|
# ══════════════════════════════════════════════════════════════════════
|
||||||
|
# CONFLICT OF INTEREST
|
||||||
|
# ══════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
conflict_check_passed = fields.Boolean(
|
||||||
|
string='Conflict Check Passed',
|
||||||
|
default=False, tracking=True,
|
||||||
|
help='Case cannot advance past Intake until the conflict-of-interest '
|
||||||
|
'check passes (or is overridden by an administrator).'
|
||||||
|
)
|
||||||
|
conflict_check_id = fields.Many2one(
|
||||||
|
'fl.conflict.check', string='Latest Conflict Check', readonly=True
|
||||||
|
)
|
||||||
|
conflict_check_ids = fields.One2many(
|
||||||
|
'fl.conflict.check', 'case_id', string='Conflict Checks'
|
||||||
|
)
|
||||||
|
|
||||||
# ══════════════════════════════════════════════════════════════════════
|
# ══════════════════════════════════════════════════════════════════════
|
||||||
# PARTIES
|
# PARTIES
|
||||||
# ══════════════════════════════════════════════════════════════════════
|
# ══════════════════════════════════════════════════════════════════════
|
||||||
@@ -794,6 +812,8 @@ class FlCase(models.Model):
|
|||||||
) or _('New')
|
) or _('New')
|
||||||
records = super().create(vals_list)
|
records = super().create(vals_list)
|
||||||
for record in records:
|
for record in records:
|
||||||
|
# 0. Conflict-of-interest screen — runs before any other action
|
||||||
|
self.env['fl.conflict.check'].run_check(record)
|
||||||
# 1. Create Odoo project for task management
|
# 1. Create Odoo project for task management
|
||||||
record._create_case_project()
|
record._create_case_project()
|
||||||
# 2. Generate deadlines if filing date already set
|
# 2. Generate deadlines if filing date already set
|
||||||
@@ -807,6 +827,20 @@ class FlCase(models.Model):
|
|||||||
return records
|
return records
|
||||||
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
|
# Block advancing past Intake until conflict check has passed
|
||||||
|
if vals.get('stage_id'):
|
||||||
|
new_stage = self.env['fl.case.stage'].browse(vals['stage_id'])
|
||||||
|
intake = self.env.ref(
|
||||||
|
'activeblue_familylaw.fl_stage_intake', raise_if_not_found=False
|
||||||
|
)
|
||||||
|
if intake and new_stage.sequence > intake.sequence:
|
||||||
|
for rec in self:
|
||||||
|
if not rec.conflict_check_passed:
|
||||||
|
raise UserError(_(
|
||||||
|
"Cannot advance case %s past Intake: the "
|
||||||
|
"conflict-of-interest check has not passed. Resolve or "
|
||||||
|
"override the conflict before changing the stage."
|
||||||
|
) % rec.name)
|
||||||
result = super().write(vals)
|
result = super().write(vals)
|
||||||
# Recalculate service-anchored deadlines when service_date is set/changed
|
# Recalculate service-anchored deadlines when service_date is set/changed
|
||||||
if 'service_date' in vals:
|
if 'service_date' in vals:
|
||||||
@@ -1090,3 +1124,15 @@ class FlCase(models.Model):
|
|||||||
'target': 'new',
|
'target': 'new',
|
||||||
'context': {'default_case_id': self.id},
|
'context': {'default_case_id': self.id},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def action_run_conflict_check(self):
|
||||||
|
self.ensure_one()
|
||||||
|
check = self.env['fl.conflict.check'].run_check(self)
|
||||||
|
return {
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'name': 'Conflict Check Result',
|
||||||
|
'res_model': 'fl.conflict.check',
|
||||||
|
'res_id': check.id,
|
||||||
|
'view_mode': 'form',
|
||||||
|
'target': 'new',
|
||||||
|
}
|
||||||
|
|||||||
215
activeblue_familylaw/models/fl_conflict_check.py
Normal file
215
activeblue_familylaw/models/fl_conflict_check.py
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
import difflib
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from odoo import _, api, fields, models
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# Fuzzy name-match threshold (difflib.SequenceMatcher ratio). Per spec.
|
||||||
|
FUZZY_THRESHOLD = 0.85
|
||||||
|
|
||||||
|
|
||||||
|
class FlConflictCheck(models.Model):
|
||||||
|
_name = 'fl.conflict.check'
|
||||||
|
_description = 'Conflict of Interest Check'
|
||||||
|
_inherit = ['mail.thread']
|
||||||
|
_order = 'create_date desc'
|
||||||
|
_rec_name = 'name'
|
||||||
|
|
||||||
|
name = fields.Char(
|
||||||
|
string='Reference', compute='_compute_name', store=True
|
||||||
|
)
|
||||||
|
case_id = fields.Many2one(
|
||||||
|
'fl.case', string='Case', required=True,
|
||||||
|
ondelete='cascade', index=True
|
||||||
|
)
|
||||||
|
check_date = fields.Datetime(
|
||||||
|
string='Check Date', default=fields.Datetime.now, readonly=True
|
||||||
|
)
|
||||||
|
status = fields.Selection([
|
||||||
|
('clear', 'Clear — No Conflict'),
|
||||||
|
('conflict', 'Conflict Detected'),
|
||||||
|
('override', 'Conflict Overridden'),
|
||||||
|
], string='Status', default='clear', required=True, tracking=True)
|
||||||
|
matched_case_ids = fields.Many2many(
|
||||||
|
'fl.case', 'fl_conflict_check_matched_case_rel',
|
||||||
|
'conflict_id', 'matched_case_id',
|
||||||
|
string='Conflicting Cases'
|
||||||
|
)
|
||||||
|
match_detail = fields.Text(string='Match Detail', readonly=True)
|
||||||
|
|
||||||
|
# ── Override (group_admin only) ────────────────────────────────────────
|
||||||
|
override_justification = fields.Text(
|
||||||
|
string='Override Justification',
|
||||||
|
help='Written justification required to override a detected conflict.'
|
||||||
|
)
|
||||||
|
override_user_id = fields.Many2one(
|
||||||
|
'res.users', string='Overridden By', readonly=True
|
||||||
|
)
|
||||||
|
override_date = fields.Datetime(string='Override Date', readonly=True)
|
||||||
|
|
||||||
|
@api.depends('case_id', 'case_id.name')
|
||||||
|
def _compute_name(self):
|
||||||
|
for rec in self:
|
||||||
|
rec.name = _('Conflict Check — %s') % (rec.case_id.name or _('New'))
|
||||||
|
|
||||||
|
# ──────────────────────────────────────────────────────────────────────
|
||||||
|
# Engine
|
||||||
|
# ──────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def run_check(self, case):
|
||||||
|
"""
|
||||||
|
Run a conflict-of-interest screen for the given case.
|
||||||
|
Creates and returns an fl.conflict.check record, sets
|
||||||
|
case.conflict_check_passed and links the latest check.
|
||||||
|
Never silently passes a conflict — always surfaces it to chatter.
|
||||||
|
"""
|
||||||
|
names = self._collect_party_names(case)
|
||||||
|
matches = self._find_conflicts(case, names)
|
||||||
|
|
||||||
|
check = self.create({
|
||||||
|
'case_id': case.id,
|
||||||
|
'status': 'conflict' if matches else 'clear',
|
||||||
|
'matched_case_ids': (
|
||||||
|
[(6, 0, list({m['case_id'] for m in matches}))] if matches else False
|
||||||
|
),
|
||||||
|
'match_detail': (
|
||||||
|
self._format_matches(matches) if matches else 'No conflicts found.'
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
|
case.conflict_check_id = check.id
|
||||||
|
|
||||||
|
if matches:
|
||||||
|
case.conflict_check_passed = False
|
||||||
|
case.message_post(
|
||||||
|
body=(
|
||||||
|
'<div style="background:#f8d7da;border:2px solid #dc3545;'
|
||||||
|
'padding:12px;border-radius:4px;">'
|
||||||
|
'<h4 style="color:#721c24;margin:0 0 8px 0;">'
|
||||||
|
'🚩 CONFLICT OF INTEREST DETECTED</h4>'
|
||||||
|
'<p>One or more parties on this case match parties on other '
|
||||||
|
'open cases. This case <b>cannot advance past Intake</b> until '
|
||||||
|
'the conflict is resolved or overridden by an administrator.</p>'
|
||||||
|
'<pre style="white-space:pre-wrap;margin:0;">'
|
||||||
|
f'{self._format_matches(matches)}</pre>'
|
||||||
|
'</div>'
|
||||||
|
),
|
||||||
|
subtype_xmlid='mail.mt_comment',
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
case.conflict_check_passed = True
|
||||||
|
case.message_post(
|
||||||
|
body='✅ Conflict-of-interest check clear — no matching parties on other open cases.',
|
||||||
|
subtype_xmlid='mail.mt_note',
|
||||||
|
)
|
||||||
|
|
||||||
|
_logger.info(
|
||||||
|
"FL Conflict Check: case %s → %s (%d match(es))",
|
||||||
|
case.id, check.status, len(matches)
|
||||||
|
)
|
||||||
|
return check
|
||||||
|
|
||||||
|
def _collect_party_names(self, case):
|
||||||
|
"""
|
||||||
|
Collect (partner_id, name, role_label) tuples for every party on a case.
|
||||||
|
Pulls from petitioner_id, respondent_id, and party_ids — deduplicated by
|
||||||
|
partner. Drops entries with no name.
|
||||||
|
"""
|
||||||
|
entries = []
|
||||||
|
seen = set()
|
||||||
|
|
||||||
|
def _add(partner, role_label):
|
||||||
|
if partner and partner.id not in seen and partner.name:
|
||||||
|
entries.append((partner.id, partner.name, role_label))
|
||||||
|
seen.add(partner.id)
|
||||||
|
|
||||||
|
_add(case.petitioner_id, 'Petitioner')
|
||||||
|
_add(case.respondent_id, 'Respondent')
|
||||||
|
for party in case.party_ids:
|
||||||
|
role_label = dict(party._fields['role'].selection).get(party.role, '')
|
||||||
|
_add(party.partner_id, role_label)
|
||||||
|
|
||||||
|
return entries
|
||||||
|
|
||||||
|
def _find_conflicts(self, case, names):
|
||||||
|
"""
|
||||||
|
Compare this case's party names against parties on other open cases.
|
||||||
|
Exact partner-id match OR fuzzy name match (>= FUZZY_THRESHOLD) flags a
|
||||||
|
conflict. Folded stages (Closed, Referred to Attorney) are treated as
|
||||||
|
not-open and skipped. Returns a list of match dicts.
|
||||||
|
"""
|
||||||
|
if not names:
|
||||||
|
return []
|
||||||
|
|
||||||
|
other_cases = self.env['fl.case'].search([
|
||||||
|
('id', '!=', case.id),
|
||||||
|
('active', '=', True),
|
||||||
|
])
|
||||||
|
|
||||||
|
matches = []
|
||||||
|
for other in other_cases:
|
||||||
|
if other.stage_id and other.stage_id.fold:
|
||||||
|
continue
|
||||||
|
other_names = self._collect_party_names(other)
|
||||||
|
for pid, pname, prole in names:
|
||||||
|
for opid, opname, oprole in other_names:
|
||||||
|
if pid == opid:
|
||||||
|
ratio = 1.0
|
||||||
|
else:
|
||||||
|
ratio = difflib.SequenceMatcher(
|
||||||
|
None,
|
||||||
|
(pname or '').lower().strip(),
|
||||||
|
(opname or '').lower().strip(),
|
||||||
|
).ratio()
|
||||||
|
if ratio >= FUZZY_THRESHOLD:
|
||||||
|
matches.append({
|
||||||
|
'case_id': other.id,
|
||||||
|
'case_ref': other.name,
|
||||||
|
'new_party': f'{pname} ({prole})',
|
||||||
|
'existing_party': f'{opname} ({oprole})',
|
||||||
|
'score': round(ratio, 2),
|
||||||
|
})
|
||||||
|
return matches
|
||||||
|
|
||||||
|
def _format_matches(self, matches):
|
||||||
|
lines = []
|
||||||
|
for m in matches:
|
||||||
|
lines.append(
|
||||||
|
f"• {m['new_party']} ↔ {m['existing_party']} "
|
||||||
|
f"on case {m['case_ref']} (similarity {m['score']:.0%})"
|
||||||
|
)
|
||||||
|
return '\n'.join(lines)
|
||||||
|
|
||||||
|
# ──────────────────────────────────────────────────────────────────────
|
||||||
|
# Actions
|
||||||
|
# ──────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
def action_override(self):
|
||||||
|
"""Manager-only override of a detected conflict. Requires justification."""
|
||||||
|
self.ensure_one()
|
||||||
|
if not self.env.user.has_group('activeblue_familylaw.group_admin'):
|
||||||
|
raise UserError(_(
|
||||||
|
'Only a Family Law Administrator can override a conflict of interest.'
|
||||||
|
))
|
||||||
|
if not (self.override_justification or '').strip():
|
||||||
|
raise UserError(_(
|
||||||
|
'A written justification is required to override a conflict.'
|
||||||
|
))
|
||||||
|
self.write({
|
||||||
|
'status': 'override',
|
||||||
|
'override_user_id': self.env.user.id,
|
||||||
|
'override_date': fields.Datetime.now(),
|
||||||
|
})
|
||||||
|
self.case_id.conflict_check_passed = True
|
||||||
|
self.case_id.message_post(
|
||||||
|
body=(
|
||||||
|
f'<strong>⚠ CONFLICT OVERRIDE</strong> authorized by '
|
||||||
|
f'{self.env.user.name}.<br/>'
|
||||||
|
f'<b>Justification:</b> {self.override_justification}'
|
||||||
|
),
|
||||||
|
subtype_xmlid='mail.mt_comment',
|
||||||
|
)
|
||||||
|
return True
|
||||||
@@ -78,6 +78,9 @@ access_fl_fee_waiver_petitioner,fl.fee.waiver petitioner,model_fl_fee_waiver,gro
|
|||||||
access_fl_income_withholding_admin,fl.income.withholding admin,model_fl_income_withholding,group_admin,1,1,1,1
|
access_fl_income_withholding_admin,fl.income.withholding admin,model_fl_income_withholding,group_admin,1,1,1,1
|
||||||
access_fl_income_withholding_paralegal,fl.income.withholding paralegal,model_fl_income_withholding,group_paralegal,1,1,1,0
|
access_fl_income_withholding_paralegal,fl.income.withholding paralegal,model_fl_income_withholding,group_paralegal,1,1,1,0
|
||||||
access_fl_income_withholding_petitioner,fl.income.withholding petitioner,model_fl_income_withholding,group_portal_petitioner,1,0,0,0
|
access_fl_income_withholding_petitioner,fl.income.withholding petitioner,model_fl_income_withholding,group_portal_petitioner,1,0,0,0
|
||||||
|
# ── fl.conflict.check ────────────────────────────────────────────────────────
|
||||||
|
access_fl_conflict_check_admin,fl.conflict.check admin,model_fl_conflict_check,group_admin,1,1,1,1
|
||||||
|
access_fl_conflict_check_paralegal,fl.conflict.check paralegal,model_fl_conflict_check,group_paralegal,1,1,1,0
|
||||||
# ── fl.intake.wizard ─────────────────────────────────────────────────────────
|
# ── fl.intake.wizard ─────────────────────────────────────────────────────────
|
||||||
access_fl_intake_wizard_admin,fl.intake.wizard admin,model_fl_intake_wizard,group_admin,1,1,1,1
|
access_fl_intake_wizard_admin,fl.intake.wizard admin,model_fl_intake_wizard,group_admin,1,1,1,1
|
||||||
access_fl_intake_wizard_paralegal,fl.intake.wizard paralegal,model_fl_intake_wizard,group_paralegal,1,1,1,1
|
access_fl_intake_wizard_paralegal,fl.intake.wizard paralegal,model_fl_intake_wizard,group_paralegal,1,1,1,1
|
||||||
|
|||||||
|
@@ -18,6 +18,9 @@
|
|||||||
<button name="action_open_support_calculator" string="Open Calculator"
|
<button name="action_open_support_calculator" string="Open Calculator"
|
||||||
type="object"
|
type="object"
|
||||||
attrs="{'invisible': [('case_type', 'not in', ['modification','dissolution_children','paternity','custody_modification'])]}"/>
|
attrs="{'invisible': [('case_type', 'not in', ['modification','dissolution_children','paternity','custody_modification'])]}"/>
|
||||||
|
<button name="action_run_conflict_check" string="Run Conflict Check"
|
||||||
|
type="object"
|
||||||
|
groups="activeblue_familylaw.group_admin,activeblue_familylaw.group_paralegal"/>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<!-- Attorney Referral Banner -->
|
<!-- Attorney Referral Banner -->
|
||||||
@@ -29,6 +32,18 @@
|
|||||||
<br/>Legal Services of Greater Miami: (305) 576-0080
|
<br/>Legal Services of Greater Miami: (305) 576-0080
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Conflict of Interest Banner -->
|
||||||
|
<div class="alert alert-danger" role="alert"
|
||||||
|
attrs="{'invisible': ['|', ('conflict_check_passed', '=', True), ('conflict_check_id', '=', False)]}">
|
||||||
|
<strong>🚩 CONFLICT OF INTEREST — UNRESOLVED</strong>
|
||||||
|
— A conflict check has flagged matching parties on other open cases.
|
||||||
|
This case cannot advance past Intake until the conflict is overridden by an administrator.
|
||||||
|
Open the
|
||||||
|
<button name="action_run_conflict_check" type="object"
|
||||||
|
class="btn btn-link p-0 align-baseline" string="conflict check"/>
|
||||||
|
for details.
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- DV Safety Note -->
|
<!-- DV Safety Note -->
|
||||||
<field name="dv_safety_note" widget="html"
|
<field name="dv_safety_note" widget="html"
|
||||||
attrs="{'invisible': [('domestic_violence_flag', '=', False)]}"/>
|
attrs="{'invisible': [('domestic_violence_flag', '=', False)]}"/>
|
||||||
@@ -97,10 +112,16 @@
|
|||||||
<field name="respondent_answered"/>
|
<field name="respondent_answered"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group string="Safety Flags">
|
<group>
|
||||||
<field name="domestic_violence_flag"/>
|
<group string="Safety Flags">
|
||||||
<field name="dv_injunction_active"
|
<field name="domestic_violence_flag"/>
|
||||||
attrs="{'invisible': [('domestic_violence_flag', '=', False)]}"/>
|
<field name="dv_injunction_active"
|
||||||
|
attrs="{'invisible': [('domestic_violence_flag', '=', False)]}"/>
|
||||||
|
</group>
|
||||||
|
<group string="Conflict of Interest">
|
||||||
|
<field name="conflict_check_passed" readonly="1"/>
|
||||||
|
<field name="conflict_check_id" readonly="1"/>
|
||||||
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<separator string="Party Details (Income, Employment, Service)"/>
|
<separator string="Party Details (Income, Employment, Service)"/>
|
||||||
<field name="party_ids">
|
<field name="party_ids">
|
||||||
@@ -375,6 +396,8 @@
|
|||||||
<field name="attorney_referral_flag"/>
|
<field name="attorney_referral_flag"/>
|
||||||
<field name="domestic_violence_flag"/>
|
<field name="domestic_violence_flag"/>
|
||||||
<field name="overdue_deadline_count"/>
|
<field name="overdue_deadline_count"/>
|
||||||
|
<field name="conflict_check_passed"/>
|
||||||
|
<field name="conflict_check_id"/>
|
||||||
<field name="petitioner_id"/>
|
<field name="petitioner_id"/>
|
||||||
<templates>
|
<templates>
|
||||||
<t t-name="kanban-card">
|
<t t-name="kanban-card">
|
||||||
@@ -404,6 +427,9 @@
|
|||||||
<t t-esc="record.overdue_deadline_count.raw_value"/> Overdue
|
<t t-esc="record.overdue_deadline_count.raw_value"/> Overdue
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
|
<t t-if="record.conflict_check_id.raw_value && !record.conflict_check_passed.raw_value">
|
||||||
|
<span class="badge rounded-pill text-bg-danger ms-1">Conflict</span>
|
||||||
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<div class="o_kanban_record_bottom" t-if="record.next_deadline.raw_value">
|
<div class="o_kanban_record_bottom" t-if="record.next_deadline.raw_value">
|
||||||
<div class="oe_kanban_bottom_left text-muted small">
|
<div class="oe_kanban_bottom_left text-muted small">
|
||||||
|
|||||||
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>
|
||||||
@@ -87,6 +87,13 @@
|
|||||||
action="action_fl_discovery_list"
|
action="action_fl_discovery_list"
|
||||||
sequence="60"/>
|
sequence="60"/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
id="menu_fl_conflict_checks"
|
||||||
|
name="Conflict Checks"
|
||||||
|
parent="menu_fl_cases"
|
||||||
|
action="action_fl_conflict_check_list"
|
||||||
|
sequence="70"/>
|
||||||
|
|
||||||
<!-- ══════════════════════════════════════════════════════
|
<!-- ══════════════════════════════════════════════════════
|
||||||
SUPPORT CALCULATOR SUB-MENU
|
SUPPORT CALCULATOR SUB-MENU
|
||||||
══════════════════════════════════════════════════════ -->
|
══════════════════════════════════════════════════════ -->
|
||||||
|
|||||||
Reference in New Issue
Block a user