Status-Driven Inventory Actions
Each order status in AccuArk can be configured with an inventory action that executes automatically when an invoice enters that status. These actions connect your order workflow directly to your inventory, ensuring that stock levels stay accurate as invoices move through their lifecycle. This article explains each of the four inventory action types in detail, including what happens internally and how the system ensures data integrity.
The Four Inventory Action Types
Every order status has an Inventory Action field set to one of four values: none, reserve, subtract, or release. The default is "none." When AccuArk's status engine processes a status change, it reads this field and executes the corresponding operation against the invoice's line items.
None
The "none" action means no inventory changes occur when an invoice enters this status. This is the default and is appropriate for most statuses in a typical workflow. Early-stage statuses like "Quote," "Draft," or "Pending Review" generally do not need to affect inventory because no stock commitment has been made yet. Similarly, administrative statuses like "On Hold" or "Awaiting Payment" typically use "none" because the order has not progressed to a point where inventory needs to be touched.
Using "none" keeps the status change lightweight — the system only updates the invoice status and records history, without loading or processing any line item data.
Reserve
The "reserve" action creates inventory reservations for each physical item on the invoice. Reservations hold stock without subtracting it from inventory. Other invoices and reports can see that the stock is committed, which reduces the available quantity without changing the on-hand quantity.
How Reserve Works Internally
When the reserve action executes:
- Existing reservations are released first. If the invoice already has active reservations (for example, from a previous status change), those reservations are released before new ones are created. This prevents duplicate reservations when an invoice re-enters a reserve status.
- The system iterates through all invoice line items. For each item, it checks two conditions:
- Service items are skipped. Items with type 1 (service) are not physical goods and do not have inventory to reserve.
- Items with quantity less than or equal to zero are skipped. There is nothing to reserve for zero-quantity or negative-quantity lines.
- A reservation record is created for each qualifying item. The reservation records the item ID, the location where stock is being held, the invoice ID, and the reserved quantity. Each reservation is stored in the inventory_reservations table with a status of "active" and a timestamp.
- Available quantity is reduced. Other parts of the system that check available stock subtract active reservations from on-hand quantities. This means that if you have 100 units on hand and 20 are reserved, the available quantity shown is 80.
Reservations are a soft hold on stock. They do not change your on-hand inventory counts, and they can be released at any time if the order is cancelled or rolled back.
Subtract
The "subtract" action permanently removes stock from inventory and creates detailed audit trail records. This is the action used when goods are actually consumed, shipped, or handed over to the customer.
How Subtract Works Internally
Subtraction only executes when the status's Subtract On Enter flag is enabled. If Subtract On Enter is disabled, the subtract action is configured but will not run automatically. Assuming Subtract On Enter is true, here is what happens:
- Existing reservations are released. Any active reservations for the invoice are marked as "fulfilled" rather than "released." The "fulfilled" status indicates that the reserved stock was actually consumed rather than simply freed. This distinction is valuable for reporting and auditing purposes.
- AccuArk's batch processing engine is initialized. AccuArk uses a bulk transaction manager for efficiency when processing multiple items in a single operation. Rather than executing individual database queries for each item, the bulk manager batches all updates and executes them together.
- The system iterates through all invoice line items. As with reserve, service items (type 1) and items with zero or negative quantity are skipped.
- For each qualifying item, two operations are queued:
- Inventory update — A negative quantity is applied to the item's stock at the invoice's location. For example, if the invoice has 5 units of Item A, the system queues a -5 update to inventory_stock_location for that item and location.
- Stock transaction record — A transaction record is created with the type "invoice_status_subtract." This record captures the item ID, the invoice ID, the negative quantity, the current date, the location, the user who initiated the change, the item price at the time of subtraction, and a descriptive note referencing the invoice number.
- All queued operations are executed in a single batch. AccuArk's batch processing engine executes all inventory updates and stock transaction records together within the same database transaction as the status change. If the batch execution fails, the entire status change transaction is rolled back.
The stock transaction records created by subtraction form a complete audit trail. You can review them in the inventory stock transaction reports to see exactly when stock was subtracted, for which invoice, by which user, and at what price.
Release
The "release" action cancels all active reservations for the invoice. This is the inverse of the reserve action and is typically used for cancellation statuses or when an order needs to be rolled back to an earlier stage.
How Release Works Internally
When the release action executes:
- All active reservations for the invoice are updated. The system finds every record in the inventory_reservations table that matches the invoice ID and has a status of "active."
- Each reservation is marked as "released." The status field is updated from "active" to "released," and the released_at timestamp is set to the current time.
- Available quantity is restored. Because the reservations are no longer active, the available quantity for the affected items increases back to the on-hand amount (minus any other active reservations from other invoices).
Releasing reservations does not create stock transaction records because no actual inventory movement occurred — the stock was never subtracted. The reservations were a soft hold that has now been removed.
Items That Are Skipped
Two categories of line items are always skipped by inventory actions:
- Service items — Items with a type of 1 (service) represent labor, consulting, or other non-physical deliverables. They have no inventory to reserve or subtract, so the system skips them during all inventory action processing.
- Zero or negative quantity items — Items with a quantity of zero or less do not require inventory operations. These might exist on an invoice due to adjustments or refund lines.
Only physical inventory items (type 0) with a positive quantity are processed by reserve and subtract actions.
Atomic Transaction Guarantee
All inventory actions execute inside the same database transaction as the status change and history record. This means:
- If the inventory action succeeds but the status update fails, everything is rolled back — including the inventory changes.
- If the status update succeeds but the history record fails, everything is rolled back — including both the inventory changes and the status update.
- If all three succeed, the entire transaction is committed and all changes become permanent simultaneously.
This atomicity guarantee is critical for data integrity. Without it, a failure partway through could leave inventory subtracted but the status unchanged, or the status updated but no history recorded. The transactional design ensures that the system is always in a consistent state.
Choosing the Right Action for Each Status
Here are guidelines for selecting the appropriate inventory action:
- Use none for statuses where no stock commitment is needed (quotes, drafts, pending review, on hold).
- Use reserve for statuses where you want to commit stock but not yet remove it (approved, confirmed, in production). This lets other invoices see that the stock is spoken for while keeping it in your on-hand count.
- Use subtract for statuses where goods are leaving your control (shipped, delivered, completed). Enable Subtract On Enter so the subtraction happens immediately.
- Use release for cancellation or rollback statuses where reserved stock should be freed (cancelled, returned, voided).
What to Read Next
- Configuring Order Statuses — Set up statuses with the appropriate inventory actions.
- Understanding the Order Status Workflow — See how inventory actions fit into the broader status change process.
- Viewing Invoice Status History — Review the audit trail of status changes and their associated inventory operations.