diff --git a/backend/modules/data_entry/db/crud/receipt.py b/backend/modules/data_entry/db/crud/receipt.py index 2855ddc..6a0fa06 100644 --- a/backend/modules/data_entry/db/crud/receipt.py +++ b/backend/modules/data_entry/db/crud/receipt.py @@ -265,7 +265,12 @@ class ReceiptCRUD: receipt: Receipt, data: ReceiptUpdate, ) -> Receipt: - """Update receipt fields.""" + """Update receipt fields. + + US-407: When a receipt is manually updated, reset processing_status and + processing_error to NULL. This allows failed OCR receipts to be corrected + manually and then submitted for approval without showing as "error" status. + """ update_data = data.model_dump(exclude_unset=True) # Recalculate tva_total from tva_breakdown if breakdown is being updated @@ -285,6 +290,12 @@ class ReceiptCRUD: for field, value in update_data.items(): setattr(receipt, field, value) + # US-407: Reset processing status when receipt is manually edited + # This clears the "failed" status so edited receipts can be submitted for approval + if receipt.processing_status == 'failed': + receipt.processing_status = None + receipt.processing_error = None + receipt.updated_at = datetime.utcnow() session.add(receipt) diff --git a/scripts/ralph/prd.json b/scripts/ralph/prd.json index b422e9f..f73662a 100644 --- a/scripts/ralph/prd.json +++ b/scripts/ralph/prd.json @@ -136,8 +136,8 @@ "npm run build passes", "Verify in browser: Editează bon cu eroare → Salvează → Statusul nu mai arată eroare" ], - "passes": false, - "notes": "" + "passes": true, + "notes": "Completed in iteration 7" }, { "id": "US-408", diff --git a/scripts/ralph/progress.txt b/scripts/ralph/progress.txt index 0694b05..fabe7b3 100644 --- a/scripts/ralph/progress.txt +++ b/scripts/ralph/progress.txt @@ -33,3 +33,14 @@ Stories: 8 (US-401 to US-408) [2026-01-12 19:31:11] Working on story: US-406 [2026-01-12 19:31:11] Running Claude... (log: /workspace/roa2web/scripts/ralph/logs/iteration_5_US-406.log) [2026-01-12 19:36:45] SUCCESS: Story US-406 passed! +[2026-01-12 19:36:45] Changes committed +[2026-01-12 19:36:45] Progress: 6/8 stories completed +[2026-01-12 19:36:47] === Iteration 6/50 === +[2026-01-12 19:36:47] Working on story: US-407 +[2026-01-12 19:36:47] Running Claude... (log: /workspace/roa2web/scripts/ralph/logs/iteration_6_US-407.log) +[2026-01-12 19:47:56] Story US-407 not yet complete, continuing... +[2026-01-12 19:47:56] Progress: 6/8 stories completed +[2026-01-12 19:47:58] === Iteration 7/50 === +[2026-01-12 19:47:58] Working on story: US-407 +[2026-01-12 19:47:58] Running Claude... (log: /workspace/roa2web/scripts/ralph/logs/iteration_7_US-407.log) +[2026-01-12 19:52:43] SUCCESS: Story US-407 passed!