feat(fusion_portal): funding-source selector on accessibility forms
Reps can now mark an accessibility assessment's funding source on the web form (Private / March of Dimes / ODSP / WSIB / Hardship / Insurance / Other) so the generated draft sale order routes to the correct funding pipeline instead of always defaulting to private pay. Adds Hardship to the x_fc_funding_source selection + sale_type_map; the new form <select> is auto-serialised by the existing FormData submit, and accessibility_assessment_save now maps funding_source -> x_fc_funding_source. The model + SO routing were already in place (2026-04 audit fix) — this closes the form + controller gap. Plan: docs/superpowers/plans/2026-06-02-accessibility-funding-selector.md Spec: docs/superpowers/specs/2026-06-02-assessment-visit-funding-design.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# Accessibility Funding-Source Selector — Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: superpowers:executing-plans (inline) — this is a 3-file change. Steps use `- [ ]` checkboxes.
|
||||
|
||||
**Goal:** Let the rep mark an accessibility assessment's funding source (Private / March of Dimes / ODSP / WSIB / Hardship / Insurance / Other) on the web form, so the generated sale order routes to the correct funding pipeline instead of always defaulting to private pay.
|
||||
|
||||
**Architecture:** The model (`fusion.accessibility.assessment.x_fc_funding_source`) and the SO routing (`_create_draft_sale_order` → `sale_type_map` → `x_fc_sale_type`) already exist (the "2026-04 portal audit fix"). The only gaps: (1) the form has no funding field, (2) the save controller never reads `funding_source` from the POST, (3) `hardship` is missing from the selectable funding sources. The submit JS already serialises every named form field via `FormData`, so no JS change is needed.
|
||||
|
||||
**Tech Stack:** Odoo 19, QWeb portal template, JSON-RPC controller. Module `fusion_portal` (worktree `K:\Github\Odoo-Modules-wt-portal`, branch `feat/assessment-visit`).
|
||||
|
||||
**Verification constraint:** `fusion_portal` depends on Enterprise `knowledge`, so it can NOT be installed on the local Community Docker. Syntax-check with host Python; functional verification is on westin (or a clone): pick "March of Dimes" on a form → the draft SO gets `x_fc_sale_type='march_of_dimes'` and lands in the MOD pipeline.
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Add Hardship to the funding source + route it
|
||||
|
||||
**Files:** Modify `fusion_portal/models/accessibility_assessment.py` (selection ~:71-87, `sale_type_map` ~:771-779)
|
||||
|
||||
- [ ] **Step 1:** Add `('hardship', 'Hardship Funding')` to the `x_fc_funding_source` selection list (after `'wsib'`).
|
||||
- [ ] **Step 2:** Add `'hardship': 'hardship',` to `sale_type_map` in `_create_draft_sale_order` (the target `x_fc_sale_type='hardship'` already exists in `fusion_claims` `sale_order.py:332`).
|
||||
- [ ] **Step 3:** `python -m py_compile fusion_portal/models/accessibility_assessment.py` → no error.
|
||||
- [ ] **Step 4:** Commit.
|
||||
|
||||
### Task 2: Add the funding select to the shared client-info form
|
||||
|
||||
**Files:** Modify `fusion_portal/views/portal_accessibility_templates.xml` (`accessibility_client_info_section`, ~:366-375)
|
||||
|
||||
- [ ] **Step 1:** Add a new row with a `<select name="funding_source">` (options mirror the model selection; `direct_private` pre-selected so existing private behaviour is unchanged) right after the phone/email row, before the card closes.
|
||||
- [ ] **Step 2:** Validate XML well-formedness (`[xml]` parse).
|
||||
- [ ] **Step 3:** Commit.
|
||||
|
||||
### Task 3: Capture funding_source in the save controller
|
||||
|
||||
**Files:** Modify `fusion_portal/controllers/portal_main.py` (`accessibility_assessment_save` vals, ~:2498-2511)
|
||||
|
||||
- [ ] **Step 1:** Add `'x_fc_funding_source': post.get('funding_source') or 'direct_private',` to the `vals` dict.
|
||||
- [ ] **Step 2:** `python -m pyflakes fusion_portal/controllers/portal_main.py` → no new undefined-name errors.
|
||||
- [ ] **Step 3:** Commit.
|
||||
|
||||
### Task 4: Verify + ship
|
||||
|
||||
- [ ] **Step 1:** Grep confirms `funding_source` flows form → controller → `x_fc_funding_source` → `sale_type_map`.
|
||||
- [ ] **Step 2:** Deploy to westin (backup → scp the 3 files → `-u fusion_portal` → cache-bust → restart) and confirm: open `/my/accessibility/stairlift/straight`, pick "March of Dimes", complete → the new SO shows `x_fc_sale_type = march_of_dimes` and appears in the MOD pipeline.
|
||||
Reference in New Issue
Block a user