fix: Add missing reasoning and consequence fields to PO approval actions
Error: 500 Internal Server Error on /dashboard/action-queue
Pydantic validation error: ActionItem requires 'reasoning' and 'consequence' fields
Root Cause:
-----------
Purchase order approval actions were missing required fields:
- Had: reasoning_data (dict) - not a valid field
- Needed: reasoning (string) and consequence (string)
The Fix:
--------
services/orchestrator/app/services/dashboard_service.py line 380-396
Changed from:
'reasoning_data': {...} # Invalid field
To:
'reasoning': 'Pending approval for {supplier} - {type}'
'consequence': 'Delayed delivery may impact production schedule'
Now action items have all required fields for Pydantic validation to pass.
Fixes the 500 error on action-queue endpoint.
This commit is contained in:
@@ -383,7 +383,8 @@ class DashboardService:
|
||||
"urgency": urgency,
|
||||
"title": f"Purchase Order {po.get('po_number', 'N/A')}",
|
||||
"subtitle": f"Supplier: {po.get('supplier_name', 'Unknown')}",
|
||||
"reasoning_data": reasoning_data, # NEW: Structured data for i18n
|
||||
"reasoning": f"Pending approval for {po.get('supplier_name', 'supplier')} - {reasoning_data.get('type', 'inventory replenishment')}",
|
||||
"consequence": "Delayed delivery may impact production schedule",
|
||||
"amount": po.get("total_amount", 0),
|
||||
"currency": po.get("currency", "EUR"),
|
||||
"actions": [
|
||||
|
||||
Reference in New Issue
Block a user