Commit Graph

7 Commits

Author SHA1 Message Date
49358183e7 Add self-hosted e-signature workflow (canvas pad + PyMuPDF embedding)
- fl.signature.request: token-protected request linking an fl.document to a
  signer (res.partner). State machine: draft → prepared → sent → signed |
  declined | expired. Per-report _SIGNATURE_COORDS map plus DOC_TYPE_TO_REPORT
  for resolving the QWeb report template and the signature block rectangle
- action_prepare renders the QWeb PDF and stores it; action_send_to_signer
  emails a one-time link /familylaw/sign/<token> (256-bit token, 14-day expiry,
  hourly cron sweeps stale links)
- apply_signature decodes the canvas-pad PNG, embeds it at the page-relative
  rectangle via PyMuPDF, attaches the signed PDF to the fl.document, marks
  the document signed, and audits the signer IP + timestamp
- Public portal controller (/familylaw/sign/<token>): GET shows the unsigned
  PDF in an iframe + inline HTML5 canvas pad (no external JS, mouse + touch);
  POST submits the PNG; separate decline endpoint. Token+state checks gate
  every transition
- action_validate_pdfa on the signed request reuses the e-filing pikepdf
  check (markers + OutputIntents) so e-filing-bound docs can be re-validated
- Wiring: models/__init__, controllers/__init__, manifest entry, ACL for the
  request, Signature Requests menu under Cases, signature_request_ids on
  fl.case with a Filings-tab list, "Request Signature" header button, and a
  cron for expiry
- Note: Odoo Sign / DocuSign / HelloSign deliberately NOT used per CLAUDE.md
  spec (HIPAA + FL court e-signature compliance)
- Verified: throwaway-DB install passes cleanly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 20:43:09 +00:00
6f6129550e Add FL e-Filing Portal integration (assisted submission, Phase 1)
- fl.efiling.submission: generates the 11th Circuit court filename
  ({LastName}_{CaseNumber}_{DocumentType}_{YYYYMMDD}.pdf), validates PDF/A via
  pikepdf (XMP pdfaid + OutputIntents, graceful if pikepdf missing), and tracks
  status (draft → validated → pending_manual → submitted → accepted/rejected/failed)
- Assisted flow: "Open e-Filing Portal" deep-links to eportal.flcourts.org
  (?caseNumber=… when available; base overridable via ir.config_parameter
  fl_efiling.portal_url); confirmation # capture; accepted/rejected mark the
  linked fl.document filed and log to chatter
- Phase 2 API stub (action_submit_api) reads creds/endpoint from ir.config_parameter
  and refuses to call an unconfirmed endpoint — no guessed URLs, no silent failure
- fl.efiling.wizard: pick document/attachment/filing_type, preview the filename,
  create + auto-validate the submission
- Wiring: model + wizard registered, ACL (admin/paralegal), e-filing views, Cases
  menu item, fl.case.efiling_submission_ids + Filings tab + Prepare e-Filing button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 00:42:28 +00:00
70c951a7ef Add timesheet / AI-audit time tracking (wraps account.analytic.line)
- fl.timesheet via delegation inheritance on account.analytic.line so billable
  hours flow through standard Odoo Accounting; duration_hours maps to unit_amount
- Fields: case_id, employee_id, is_billable, ai_agent, duration_hours, computed
  hourly_rate/billable_amount (rate from hr.employee.fl_hourly_rate, else firm
  default ir.config_parameter fl_timesheet.default_hourly_rate)
- _resolve_analytic_account: prefers the case project's analytic account
  (version-agnostic field lookup), falls back to a cached firm account under any
  available analytic plan — handles the required account_id on the wrapped line
- Add 'analytic' to manifest depends; ACL for fl.timesheet and account.analytic.line
  (admin + paralegal) so non-admins can post entries
- fl.case: timesheet_ids + total_billable_hours/amount + total_ai_audit_hours +
  currency_id; new Time & Billing tab; Timesheets menu + standalone views
- Both AI agents now log non-billable audit entries via sudo() (paralegal +
  attorney, ai_agent set); logging stays a guarded no-op if creation fails

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 00:26:00 +00:00
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
23c54b1b9f Align case stages to 5-stage spec and add Paralegal AI agent
Stage alignment:
- Replace the 11 procedural stages with the spec's 5-stage machine
  (Intake/Active/Discovery/Pre-Trial/Closed); only Closed is folded
- Make fl_stage_data.xml updatable (drop noupdate) so the rename applies on
  upgrade; keep fl_stage_intake/discovery/closed XML ids
- Update case search filters to the new stage names (Intake/Active/Discovery/Pre-Trial)

Issue-tag bug fix (fl_ai_engine):
- Rule-based tagging and caselaw matching compared snake_case keys against the
  human-readable seeded tag names, so they never matched and issue_tag_ids was
  never populated. Add RULE_KEY_TO_TAG_NAME and translate keys to real names
  before all fl.issue.tag / fl.caselaw lookups

Paralegal agent (fl.paralegal.agent, AbstractModel):
- on_stage_change(): fast rule-based pass fired automatically on stage entry and
  case creation — generates the stage task batch (idempotent), recalculates
  filing/service deadlines, cross-references statutes by issue tag + case type,
  posts a chatter summary. No Claude call, so it never blocks the workflow
- run_manual(): full pass adding a best-effort Claude procedural briefing with
  rule-based fallback; wired to a "Paralegal Review" button on the case form
- AI audit-time logging is guarded behind a fl.timesheet existence check
  (model not built yet)
- fl.case.write fires on_stage_change only when stage_id actually changes;
  create() generates the Intake batch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 19:12:53 +00:00
7bc0cc8554 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>
2026-05-28 18:19:32 +00:00
Carlos Garcia
1d52d85a78 Phase 1: core models, security, seed data, and backend views
Implements full Phase 1 of the activeblue_familylaw Odoo 18 module:
- 17 Python models (fl.case, fl.party, fl.child, fl.support.calculation,
  fl.fee.waiver, fl.income.withholding, fl.deadline, fl.hearing,
  fl.deposition, fl.discovery, fl.document, fl.caselaw, fl.analysis,
  fl.ai.engine, fl.argument, fl.statute, fl.issue.tag) + hr.expense extension
- 3 wizard stubs (intake, analysis, generate-packet)
- Security: 4 groups (admin/paralegal/portal-petitioner/portal-respondent)
  + record rules scoping portal users to their own cases
- Seed data: issue tags, FL statutes, FL DCF support schedule, ir.sequence
- 13 backend view XML files with FL 61.30 worksheet, fee waiver
  eligibility banner, DV safety resources, emancipation alerts
- Static CSS/JS stubs for Phase 6 portal

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 18:52:04 -04:00