# Weekly stock replenishment brief from ERPNext to Slack

> Every Monday at 7am, find out which items will run out before your supplier can deliver, with draft restock requests waiting for approval.

- Workflow type: agent
- Services: ERPNext, Slack Bot
- Categories: Operations
- Published: 2026-08-04

## What it does

- Checks every item that carries a reorder level against what is really on the shelf, warehouse by warehouse, instead of trusting a stale number.
- Adds up stock already on its way in on open purchase orders and requests, so you never reorder something that is already inbound.
- Ranks each shortfall by urgency using your supplier lead times, and calls out anything that will run out before a new delivery could realistically arrive.
- Leaves a draft restock request in ERPNext for every shortfall so a person approves the spend, then posts the ranked brief to your procurement channel in Slack.

## What you'll need

- An ERPNext account with permission to view stock and create material requests
- Items set up with a reorder level and safety stock, plus a default supplier and lead time filled in on the item
- A Slack workspace and the channel your procurement team watches

## Prompt

Every Monday at 7am, build me a stock replenishment brief from ERPNext and post it to my procurement channel in Slack.

Start with ERPNext List Documents on the Item doctype to pull every item that carries a reorder level and safety stock. For each of those items also read the fields the rest of this workflow depends on: the default supplier, the supplier lead time on the Item record, the item group, the default warehouse, and the stock unit of measure.

For each item and warehouse pair, call Get Stock Balance (erpnext.stock.utils.get_stock_balance) to get the real on hand quantity. Do not trust a cached quantity on the Item record, use the actual balance.

Next, cross reference open supply so we never double order something that is already inbound. Use List Documents on Purchase Order and on Material Request to find documents that are submitted (docstatus 1) but not yet fully received, and total the outstanding quantity already on its way in for each item and warehouse. Subtract nothing that has already been received.

For every item where on hand plus inbound falls below the reorder level, judge the urgency yourself rather than sorting by shortfall size. Compare how long the remaining stock will last against the supplier lead time on the Item record. A reorder point that does not account for lead time still produces stockouts even when the rule triggers correctly, so an item with a 21 day lead time and 9 days of cover is far more urgent than an item with a 3 day lead time and a bigger raw shortfall. If an item has no lead time recorded, still report it and flag the missing lead time instead of guessing.

For each shortfall, create a draft Material Request in ERPNext with Create Document for the shortfall quantity, targeting the right warehouse and using a required by date that reflects the supplier lead time. Leave every one of them as a draft with docstatus 0 so a human reviews and submits it. Do not submit them, and do not auto commit spend.

Finally, post a Send a Message digest to the procurement channel in Slack. Rank the shortfalls by urgency, and for each one name the item, the warehouse, the on hand quantity, the inbound quantity, the reorder level, the shortfall, the supplier, the supplier lead time, and the draft Material Request that was created for it. Explicitly call out any item that will stock out before its lead time elapses, since those are the ones that need a phone call and not just an approval. If nothing is below its reorder level, post a short all clear message instead of an empty table.

## How to customize

- Change the timing, for example every morning during peak season instead of Monday at 7am
- Narrow it to specific warehouses, item groups, or a single supplier
- Raise or lower the urgency thresholds, or skip items below a minimum order value

## Example output

Stock replenishment brief, Monday 7am
3 items below reorder level. 1 will stock out before it can be replaced.

1. URGENT, stocks out before delivery. Stainless hinge 40mm, Main Warehouse. On hand 120, inbound 0, reorder level 500, shortfall 380. Supplier Ferrum Metals, lead time 21 days. Recent usage burns through the remaining stock in about 9 days, so this runs dry roughly 12 days before a new order could land. Draft MREQ-2026-00418 created.

2. High. Powder coat black 5L, Main Warehouse. On hand 45, inbound 60, reorder level 150, shortfall 45. Supplier Coatline, lead time 10 days. Inbound stock covers most of the gap but not all of it. Draft MREQ-2026-00419 created.

3. Watch. M6 socket screws, Overflow Store. On hand 2400, inbound 0, reorder level 3000, shortfall 600. Supplier Fastenwell, lead time 3 days. Comfortable cover against the lead time. Draft MREQ-2026-00420 created.

All three requests are drafts. Review and submit them in ERPNext.

## FAQ

### Will this order stock automatically?

No. Every restock request is left as a draft in ERPNext for someone on your team to review and submit. Nothing is committed to a supplier without a person approving it first.

### ERPNext already creates material requests when stock hits the reorder level. Why use this?

The built in rule only looks at the reorder number itself. This brief also weighs your supplier lead times, so an item with a three week lead time is treated as far more urgent than one you can restock in two days. It also skips items that already have enough stock inbound.

### Will it double order things that are already on their way?

No. Before flagging a shortfall it totals everything already ordered or requested but not yet received, and only reports the gap left after that inbound stock is counted.

### What if some items have no supplier lead time filled in?

They still appear in the brief as shortfalls, and the message flags that the lead time is missing so you can add it and get a proper urgency ranking next week.

### Does this work across more than one warehouse?

Yes. Stock is checked for each item and warehouse combination, and the brief names the warehouse each shortfall belongs to.

Use this prompt in General Input: https://www.generalinput.com/prompts/weekly-stock-replenishment-brief-from-erpnext-to-slack