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

@@ -808,6 +808,99 @@ class FlCase(models.Model):
# WORKFLOW METHODS
# ══════════════════════════════════════════════════════════════════════
# Standard task templates keyed by case_type.
# Each entry: (name, description, sequence)
_CASE_TASK_TEMPLATES = {
'modification': [
('Gather Financial Documents',
'Collect last 3 years tax returns, pay stubs, bank statements '
'(FL 12.285 mandatory disclosure — 45 days from service)',
10),
('Complete Financial Affidavit',
'Complete FL-12.902(b) Short Form or FL-12.902(c) Long Form '
'financial affidavit (required for support proceedings)',
20),
('Calculate New Support Amount',
'Run FL 61.30 child support calculation using updated income figures. '
'Verify modification threshold: 15% AND $50 difference (FL 61.30(1)(b))',
30),
('File Supplemental Petition',
'File FL-12.905 Supplemental Petition to Modify Child Support '
'with the clerk and pay filing fee (or submit fee waiver)',
40),
('Serve Respondent',
'Serve Respondent with Summons + Petition. '
'Start 20-day answer deadline clock (FL 12.285, Rule 1.070)',
50),
('Track Answer Deadline',
'Monitor 20-day answer deadline. If no response, prepare '
'FL 12.922 default motion packet after deadline passes.',
60),
('Schedule / Attend Mediation',
'Attend court-ordered mediation (required in most family cases). '
'Confirm separate rooms if DV flag is set (FL 44.102)',
70),
('Attend Final Hearing',
'Appear at final hearing with all documents. '
'Bring original + 2 copies of all filed pleadings.',
80),
],
'dissolution_children': [
('Gather Financial Documents', 'FL 12.285 mandatory disclosure package', 10),
('Complete Financial Affidavit (Long Form)',
'FL-12.902(c) required when income > $50,000/year', 20),
('Calculate Child Support', 'FL 61.30 worksheet (FL-12.902(e))', 30),
('Draft Parenting Plan', 'FL-12.995(a) Parenting Plan — timesharing schedule', 40),
('File Petition for Dissolution', 'FL-12.901(b)(1) with all required attachments', 50),
('Serve Respondent', 'Serve Summons + Petition; track 20-day answer deadline', 60),
('Attend Parenting Class',
'FL 61.21 — both parties must complete before final hearing', 70),
('Schedule Mediation', 'Court-ordered mediation (FL 44.102)', 80),
('Attend Final Hearing', 'Bring parenting plan, support worksheet, all exhibits', 90),
],
'dissolution_no_children': [
('Gather Financial Documents', 'FL 12.285 mandatory disclosure', 10),
('Complete Financial Affidavit', 'FL-12.902(b) Short Form', 20),
('Identify and Value Marital Assets', 'Real property, accounts, retirement funds', 30),
('File Petition for Dissolution', 'FL-12.901(b)(2) — no minor children', 40),
('Serve Respondent', 'Serve Summons + Petition; track 20-day answer deadline', 50),
('Schedule Mediation', 'Property division mediation if contested', 60),
('Attend Final Hearing', 'Bring financial affidavit, marital settlement agreement', 70),
],
'paternity': [
('Gather Birth Records', 'Obtain certified birth certificate', 10),
('Complete Financial Affidavit', 'FL-12.902(b) required for support', 20),
('Calculate Child Support', 'FL 61.30 worksheet', 30),
('File Petition to Determine Paternity', 'FL-12.983(a)', 40),
('Serve Respondent', 'Summons + Petition; 20-day deadline', 50),
('Draft Parenting Plan', 'FL-12.995(a) if timesharing is requested', 60),
('Attend Parenting Class', 'FL 61.21 — required before final hearing', 70),
('Attend Final Hearing', 'Bring all documents and parenting plan', 80),
],
'alimony_modification': [
('Gather Financial Documents', 'Tax returns, pay stubs — show substantial change', 10),
('Complete Financial Affidavit (Long Form)', 'FL-12.902(c) required', 20),
('Document Change in Circumstances',
'Document the substantial change in circumstances required for modification', 30),
('File Supplemental Petition', 'FL-12.905 Supplemental Petition to Modify Alimony', 40),
('Serve Respondent', 'Summons + Petition; track 20-day answer deadline', 50),
('Schedule Mediation', 'FL 44.102 mediation', 60),
('Attend Final Hearing', 'Bring all financial documents and exhibits', 70),
],
'custody_modification': [
('Document Changed Circumstances',
'Substantial change must affect child welfare — document thoroughly', 10),
('Gather Supporting Evidence', 'School records, medical records, witness statements', 20),
('Complete Financial Affidavit', 'FL-12.902(b) if support change is involved', 30),
('Draft Proposed Parenting Plan', 'FL-12.995(a) — proposed new timesharing', 40),
('File Supplemental Petition', 'FL-12.905 Supplemental Petition to Modify Custody', 50),
('Serve Respondent', 'Summons + Petition; track 20-day answer deadline', 60),
('Attend Parenting Class', 'FL 61.21 if not already completed', 70),
('Schedule Mediation', 'Court-ordered mediation (FL 44.102)', 80),
('Attend Final Hearing', 'Bring parenting plan, evidence, exhibits', 90),
],
}
def _create_case_project(self):
"""Create a linked Odoo project for case task management."""
project = self.env['project.project'].create({
@@ -819,6 +912,26 @@ class FlCase(models.Model):
),
})
self.project_id = project
self._generate_case_tasks()
def _generate_case_tasks(self):
"""
Create standard project tasks for this case based on its case_type.
Templates are defined in _CASE_TASK_TEMPLATES above.
"""
if not self.project_id:
return
templates = self._CASE_TASK_TEMPLATES.get(self.case_type, [])
task_vals_list = []
for name, description, sequence in templates:
task_vals_list.append({
'name': name,
'description': description,
'project_id': self.project_id.id,
'sequence': sequence,
})
if task_vals_list:
self.env['project.task'].create(task_vals_list)
def _check_fee_waiver_eligibility(self):
"""Post a chatter note if petitioner appears to qualify for fee waiver."""