Skip to content

Per-Delivery Inventory Routing ​

App ID: inventory-routing.per-delivery

The per-delivery variant of the Inventory Routing app family. Each delivery is fulfilled from one warehouse — the warehouse is stored in delivery.dynamic.inventoryKey. When an order line spans multiple warehouses, the app creates additional deliveries (one per inventory) so the per-delivery invariant always holds.

A delivery is a fulfilment for one warehouse

Each delivery is fulfilled from a single warehouse. When the surrounding systems (WMS, ERP, picking station, courier integration) need exactly one fulfilment per warehouse, this is the variant for you.

If your WMS / ERP can consume a single fulfilment that mixes warehouses, look at the per-orderline variant instead.

What the app contributes ​

ContributionPurpose
delivery.inventoryKey graph field (enum)Surfaces the resolved warehouse as a queryable / filterable field on deliveries in the portal and graph queries.
delivery.inventoryDate graph field (instant)The "as-of" date used for stock availability — controls whether incoming shipments count toward stock.
Channel-country priority editor (portal)A drag-and-drop UI inside the channel settings for ordering warehouses per country.
Auto-assign delivery context menu itemLets an agent right-click a delivery and re-trigger routing without manually toggling the inventoryKey.
Rule: autoAssign.hrl (fires on OnOrderValidate)The routing brain. Resolves auto_assign to real warehouses, splits lines across deliveries, manages reservations.

A separate optional companion rule for defaulting these fields on orders coming from the Commerce app also ships with the package — see Companion rules below.

The two dynamic fields ​

These are the only routing knobs callers set directly on an order. Everything else is configuration of the app, not data on an order.

delivery.inventoryKey ​

ValueMeaning
(empty)Delivery is invisible to the routing app. No stock reservations placed, no routing decisions made. Useful for legacy or imported orders that should not be touched.
"auto_assign" (literal string)"Hantera, pick a warehouse for me." The app will replace this value with a real inventory key on the next OnOrderValidate.
"warehouse-x" (any real key)Pinned. The app respects the choice, places stock reservations against that warehouse, and does not re-route — unless someone sets it back to auto_assign.

The enum registry source for this field is the standard inventories enum, so the dropdown in the portal lists every configured warehouse.

delivery.inventoryDate ​

The instant at which stock availability is evaluated. Passed to calculateAvailableStock as the asOf parameter, so for example:

  • inventoryDate = today → only currently physically present stock counts.
  • inventoryDate = today + 3 days → physical stock plus any incoming shipments scheduled to arrive within 3 days counts.
  • inventoryDate = today + 30 days → suitable for pre-orders where the customer accepts a 30-day delivery window.

If your order source does not set inventoryDate explicitly, you either need to provide a default yourself (a one-line rule fired when the order is created) or the routing will use the default zero instant — which means no incoming shipments count. For Commerce-sourced orders the optional companion rule (see below) does this automatically.

Lifecycle decision flow ​

The whole decision is re-evaluated every time the order changes — so adding a line, cancelling a delivery, or toggling inventoryKey back to auto_assign all cause the app to re-think the routing.

Companion rules ​

The app ships one optional companion rule that does not perform routing itself but improves the experience when used alongside specific other apps:

RuleWhat it doesWhen it's relevant
OnCommerceCartToOrder.hrlSets inventoryKey: "auto_assign" and inventoryDate: today on the new delivery if missing.Only fires for orders created by the Commerce app. Has no effect on orders from other sources.

If your tenant uses a different order source, simply ignore the companion rule — or write a similar one-line rule to do the same defaulting in your own integration.

  • Configuration — set up channel-country warehouse priorities, understand where the data is stored, and how to seed it from your ERP.
  • Auto-Assignment — the routing algorithm in operator terms, with a case table showing what the order view looks like for each scenario.
  • Back-Orders — what happens when stock is insufficient, and how to clear back-orders once stock arrives.
  • Stock Reservations — when reservations are placed, released, and consumed across the order lifecycle.

© 2026 Hantera AB. Org. no.: 559242-9582