Tech debt: reverse approval-time inventory increments when a PO is cancelled (deferred from #53) #55
Labels
No labels
bug
claude-failed
claude-pr
claude-queue
claude-working
feature
interactive
portal
triaged
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: shad0w/pelagia-portal#55
Loading…
Add table
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?
Tech debt — deferred from #53 (PO cancellation)
When a PO is approved with a
siteId, approval incrementsItemInventory(app/(portal)/approvals/[id]/actions.ts). The cancel feature (#53) does not reverse that increment, by decision — inventory is currently feature-flagged off (NEXT_PUBLIC_INVENTORY_ENABLED), so a cancelled approved PO can leave a stale stock increment behind.To do (when inventory is brought live)
cancelPo, if the PO had reached an inventory-incrementing state (approved with asiteId) and the increment was applied, decrement the sameItemInventoryquantities for its line items with aproductId.Why deferred
Per the #53 answers: "Should approval-time inventory increments be reversed on cancel? — Mark this as a new tech debt issue and on wiki, to be resolved when this inventory increment has to be brought to live."
Tracked on the wiki under Inventory-and-Catalogue.