OCR approval fails: receipt_ocr not valid for inventory_items.source constraint #101
Labels
No labels
accessibility
backlog
beta-feedback
bug
duplicate
enhancement
feature-request
help wanted
invalid
needs-design
needs-triage
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Circuit-Forge/kiwi#101
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
POST /api/v1/receipts/{id}/ocr/approvewill fail when trying to create inventory items becauseocr.pyusessource="receipt_ocr"which is not in theinventory_items.sourceCHECK constraint.Steps to reproduce
POST /api/v1/receipts/{id}/ocr/approveExpected
Inventory items are created from OCR line items.
Actual
sqlite3.IntegrityError: CHECK constraint failed: source IN (\u2018barcode_scan\u2019, \u2018manual\u2019, \u2018receipt\u2019)Root cause
app/api/endpoints/ocr.pyline 222:store.add_inventory_item(..., source="receipt_ocr")but theinventory_items.sourcecolumn constraint only allows(barcode_scan, manual, receipt). The valuereceipt_ocris only valid for theproducts.sourceconstraint.Fix
Change
source="receipt_ocr"tosource="receipt"inocr.pyline 222 for theadd_inventory_itemcall. Products can keepsource="receipt_ocr".