From 837e7b09b74f65dc370e681697c5b04d95c62894 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Tue, 2 Jun 2026 08:48:16 -0400 Subject: [PATCH] fix(fusion_portal): define visit._assessment_sale_type (ADP grouping key) action_complete_visit referenced self._assessment_sale_type() to group ADP devices by funding, but the method was never defined - any visit containing an ADP device would have raised AttributeError. Mirrors fusion.assessment._create_draft_sale_order: adp_odsp for ODSP client streams, adp otherwise. Caught by the clone ADP-grouping smoke test. Co-Authored-By: Claude Opus 4.8 (1M context) --- fusion_portal/models/visit.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fusion_portal/models/visit.py b/fusion_portal/models/visit.py index eaebdec1..f2b2b69e 100644 --- a/fusion_portal/models/visit.py +++ b/fusion_portal/models/visit.py @@ -216,6 +216,15 @@ class FusionAssessmentVisit(models.Model): if len(walkers) > 1: raise UserError(_('An ADP order can include only one walker / rollator.')) + def _assessment_sale_type(self, adp_assessment): + """Funding workflow key for an ADP equipment assessment, mirroring + fusion.assessment._create_draft_sale_order: ADP+ODSP when the client + type is an ODSP stream, plain ADP otherwise. ADP devices that share a + key are grouped onto one sale order.""" + if adp_assessment.client_type in ('ods', 'acs', 'owp'): + return 'adp_odsp' + return 'adp' + def action_complete_visit(self): """Group the visit's accessibility assessments by funding workflow and create one draft SO per workflow. ADP equipment assessments keep their