fusion_claims: ADP workflow recovery actions + email gap fixes

Workflow (from the FigJam ADP board):
- 9 new ADP action methods to wire up the orphan states that the board
  showed had no entry or no exit path: put_on_hold, withdraw, mark_denied,
  mark_rejected, mark_needs_correction, cancel, reopen_cancelled,
  reopen_expired, resubmit_from_denied.
- 12-month auto-expire cron (_cron_adp_expire_approved) configurable via
  fusion_claims.adp_approval_expiry_months, runs daily at 03:00.
- 3 new recovery buttons in the ADP form view (Reopen cancelled, Reopen
  expired, Resubmit from denied) in both the primary status bar and the
  secondary details panel.

Email (from the 2026-04 email audit):
- 6 new ADP stage email methods via a shared _adp_send_stage_email helper:
  assessment_scheduled, assessment_completed, application_received, accepted,
  cancelled, expired. Each has a matching dispatch entry in write().
- _send_rejection_email now includes the client (was authorizer-only).
- _send_accepted_email excludes the authorizer per the new rule: "Accepted"
  is a passive intermediate state with no authorizer action required.
- _send_ready_for_delivery_email excludes the authorizer: operational
  scheduling, not delivery confirmation. Authorizers are notified at
  case_closed when the product is actually delivered.
- action_adp_put_on_hold and action_adp_withdraw now fire their matching
  email methods so direct action-method calls get the same notifications
  as the status_change_reason_wizard path.

Authorizer notification rule (locked in for this update):
  Send to authorizer ONLY for initial involvement (assessment/submit/
  resubmit), delivery confirmation (case_closed), and problem states
  (rejected, denied, needs_correction, withdrawn, on_hold, cancelled,
  expired). Skip for billing, payment, ready_delivery scheduling, and
  passive intermediates (accepted).

Scope: ADP + ADP/ODSP only. MOD workflow emails reverted and deferred
to a separate update.

Deployed to odoo-westin (westin-v19) and odoo-mobility (mobility).
Pre-existing stock_route_warehouse FK orphans on mobility worked around
by verifying fusion_claims transaction committed before container restart.
This commit is contained in:
gsinghpal
2026-04-09 06:06:33 -04:00
parent d60a75a391
commit 8b2cbd9085
5 changed files with 548 additions and 10 deletions

View File

@@ -1274,7 +1274,33 @@
icon="fa-play"
invisible="not x_fc_is_adp_sale or x_fc_adp_application_status != 'on_hold'"
help="Resume this application from hold"/>
<!-- ============================================================ -->
<!-- RECOVERY BUTTONS - bring stuck orders back into the workflow -->
<!-- Added 2026-04 to wire up the exit paths drawn in the FigJam -->
<!-- ============================================================ -->
<button name="action_adp_reopen_cancelled" type="object"
string="Reopen" class="btn-info"
icon="fa-refresh"
invisible="not x_fc_is_adp_sale or x_fc_adp_application_status != 'cancelled'"
confirm="Reopen this cancelled application at the Quotation stage?"
help="Return a cancelled application to Quotation"/>
<button name="action_adp_reopen_expired" type="object"
string="Reopen" class="btn-info"
icon="fa-refresh"
invisible="not x_fc_is_adp_sale or x_fc_adp_application_status != 'expired'"
confirm="Reopen this expired application at the Quotation stage?"
help="Return an expired application to Quotation"/>
<button name="action_adp_resubmit_from_denied" type="object"
string="Resubmit" class="btn-primary"
icon="fa-repeat"
invisible="not x_fc_is_adp_sale or x_fc_adp_application_status != 'denied'"
confirm="Send this denied application back to Ready for Submission for a fresh attempt?"
help="Send a denied application back to Ready for Submission"/>
<!-- ============================================================ -->
<!-- EXCEPTION BUTTONS - Put On Hold / Withdraw -->
<!-- ============================================================ -->
@@ -1472,8 +1498,28 @@
required="x_fc_stage_after_ready_submission"
readonly="x_fc_case_locked"/>
<!-- Recovery Action Buttons - visible only for stuck states -->
<div class="mt-2" colspan="2"
invisible="x_fc_case_locked or x_fc_adp_application_status not in ('cancelled', 'expired', 'denied')">
<button name="action_adp_reopen_cancelled" type="object"
string="Reopen" class="btn-info btn-sm me-1"
icon="fa-refresh"
invisible="x_fc_adp_application_status != 'cancelled'"
confirm="Reopen this cancelled application at the Quotation stage?"/>
<button name="action_adp_reopen_expired" type="object"
string="Reopen" class="btn-info btn-sm me-1"
icon="fa-refresh"
invisible="x_fc_adp_application_status != 'expired'"
confirm="Reopen this expired application at the Quotation stage?"/>
<button name="action_adp_resubmit_from_denied" type="object"
string="Resubmit" class="btn-primary btn-sm me-1"
icon="fa-repeat"
invisible="x_fc_adp_application_status != 'denied'"
confirm="Send this denied application back to Ready for Submission for a fresh attempt?"/>
</div>
<!-- Status Action Buttons (require reason popup) - Hidden when locked -->
<div class="mt-2" colspan="2"
<div class="mt-2" colspan="2"
invisible="x_fc_case_locked or x_fc_adp_application_status in ('quotation', 'cancelled', 'case_closed', 'expired')">
<button name="%(fusion_claims.action_set_status_on_hold)d"
type="action" string="Put On Hold"