You have open Sales Orders, some partly produced and partly delivered. You open a Production Plan, get the Sales Orders and their items, and expect the quantities still to be made. Instead some orders don't appear, and others show nothing pending although a Work Order fell short through rejection or scrap. ERPNext decides this from counters on the Sales Order Item, and they count what was planned or ordered for production, not what was made. This guide shows which counters decide what, how to check them, and how to re-plan the shortfall.
Production planning with partial production is where ERPNext's manufacturing module has its roughest edges. The Production Plan pulls Sales Orders and their pending quantities from counters on the Sales Order Item, and those counters move when a plan or a Work Order is made, not when the goods are. I am Manoj, and I lead ERPNext and Frappe implementations at MithTech, a team of Frappe specialists in Bengaluru. Re-planning a shortfall is one of the questions manufacturing clients raise once they run real volumes.
Why does "Get Items" show the wrong quantity?
A Production Plan built from Sales Orders works in two steps, and each reads a different counter on the Sales Order Item. In ERPNext v15:
Get Sales Orders: list the order while so_item.qty > so_item.production_plan_qty
Get Items: pending_qty = so_item.qty - max(so_item.work_order_qty, so_item.delivered_qty)
That gives three ways for the plan to come out wrong:
1. The counter already covers a shortfall. production_plan_qty rises when a plan is submitted and work_order_qty when a Work Order is made. Neither falls back when the Work Order produces less than planned. If a Work Order for 30,000 made 29,000, the order still looks fully covered and the missing 1,000 is not offered to the next plan. When several Sales Orders are combined into one Work Order, the link back to each order can be lost as well, so its produced quantity isn't updated (forum thread 163260).
2. A filter on the plan excludes the order. Stopped and Closed orders never appear. If you set a Sales Order status, customer, project, item or date filter on the plan, orders outside it are left out. Check the filters before you suspect the data.
3. No active BOM. Items are returned only when a BOM with is_active = 1 exists for them. This happens when a BOM is deactivated during an engineering change, or a new version is made but not submitted.
How do you see the gap?
The Fulfillment Gap Calculator breaks a Sales Order quantity into its parts: what has been delivered, what is in production, what can be planned with the material you have, and what is blocked.
Calculator
Fulfillment Gap Calculator
Enter your SO quantity, delivered, in-production, and material availability to see the exact breakdown of what can and cannot be planned for production.
How do you diagnose your case?
The Production Plan Debugger walks through the checkpoints. Answer each question about your Sales Order and it points to the cause that applies.
Interactive
Production Plan Debugger
Diagnostic checks to identify why Get Items from Sales Orders shows wrong or zero pending quantities. Each check explains what to look for and what the fix is.
What is the fix?
The fix depends on the cause. The recipe below has scripts to query unfulfilled Sales Order items directly, to compare the counters with what was planned, and to check material availability. Read them against the two formulas above before you run anything that writes to Sales Order Items, and try them on a copy of your site first.
Code recipe
Production Plan Fix Recipe
Python recipe: query unfulfilled SO items with pending qty and an active BOM, compare the planning counters against actual Production Plan and Work Order records, and check raw material availability against BOM requirements.
0 of 4 steps done
Tick a step’s number when it is done; the ticks stay on this device.
List what is really unfulfilled
From the bench console, list each open Sales Order Item with its qty, delivered_qty, production_plan_qty and work_order_qty, and the produced quantity of the Work Orders linked to it. Where the produced quantity is below work_order_qty, you have a shortfall the plan can't see.
Decide how to plan the shortfall
Don't edit the counters by hand as a habit: they are maintained by ERPNext and a manual change is overwritten or breaks the link to the documents. For a one-off shortfall, raise a Work Order for the missing quantity (with the Sales Order reference in the remarks), or plan that item without the Sales Order. If shortfalls are routine, agree a standard way with whoever owns your ERPNext instance, and test it on a copy first.
Check material availability
For each item you plan to make, check raw material stock in the source warehouse against the BOM for the quantity. That tells you what can run now and what needs a Material Request first.
Create the Work Orders
Create Work Orders for the quantity you can make, and Material Requests for what is blocked. Note the reason for any shortfall Work Order, so the next person can follow why an order has more than one.
What does the planning workflow look like, with its failure points?
The flow below shows the path from Sales Order to delivery, with the points where production planning goes wrong.
Interactive
Planning Workflow Diagram
Click through each step of the production planning workflow to see what can go wrong, from SO to Get Items to BOM check to material availability to Work Order completion to delivery.
What should you know before you change anything?
Test on a copy first. Any script that writes to Sales Order Items changes records that other documents depend on. Run it on a copy of the site, compare the results, and only then on production, outside working hours.
Material availability is point-in-time. A stock check reads current stock. Between the check and Work Order creation, other plans, purchase receipts and stock entries move it. Run the check just before you create Work Orders.
Multi-level BOMs. After getting items, "Get Sub Assembly Items" explodes the BOMs and adds the sub-assemblies to make. The counters above sit on the top-level Sales Order Item, so the shortfall question is asked there.
| Likely cause | ||
|---|---|---|
| Get Items shows 0 after a Work Order fell short | work_order_qty counts the full Work Order, not what it made | Plan the shortfall with its own Work Order and a note |
| Sales Order not listed by Get Sales Orders | production_plan_qty already equals qty, or a plan filter excludes it | Check the plan's filters, then the counter |
| Item does not appear in Get Items at all | No active BOM for the item | Submit or re-activate the BOM |
| Sales Order never appears | Order is Stopped or Closed | Re-open the order if it is still live |
| Pending quantity lower than expected after a delivery | delivered_qty is larger than work_order_qty, so delivery sets the pending figure | Check deliveries made from stock against the order |
Production Plan symptoms, causes and fixes (ERPNext v15)
At a glance
| Aspect | What to know |
|---|---|
| Is the Sales Order listed? | Only while an item's qty is above its production_plan_qty, and the order is not Stopped or Closed |
| Pending quantity on Get Items | qty - max(work_order_qty, delivered_qty) |
| BOM | The item needs an active BOM |
| The usual trap | A Work Order that made less than planned still counts in full |
Frequently asked questions
Why does ERPNext Production Plan show zero pending quantity for my Sales Order?
Because the pending quantity is qty - max(work_order_qty, delivered_qty) on the Sales Order Item, and work_order_qty counts what Work Orders were made for, not what they produced. If a Work Order fell short, the order still looks fully covered. Plan the shortfall with its own Work Order and a note of why.
How do I get items from partially delivered Sales Orders in ERPNext?
Use the Production Plan: get the Sales Orders, then get the items. An order is listed while an item's quantity is above its production_plan_qty, and each item's pending quantity is its quantity less the larger of work_order_qty and delivered_qty. If items are missing, check the plan's filters, that the item has an active BOM, and the counters on the Sales Order Item.
What are planned_qty, production_plan_qty and work_order_qty on a Sales Order Item?
They are counters ERPNext keeps for production. production_plan_qty is what submitted Production Plans have covered, and decides whether the order is listed for a new plan. work_order_qty is what Work Orders have been made for, and with delivered_qty decides the pending quantity. planned_qty and produced_qty record planned and produced quantities for production. None of them falls back when a Work Order produces less than planned.
How do I check material availability for production planning in ERPNext?
In the Production Plan, get the raw materials for the planned items: ERPNext compares the BOM requirement for the planned quantity with stock in the warehouses you choose, and lists shortages to raise Material Requests for. Run it just before you create Work Orders, as stock moves in between.
Why does Get Items not show items without a BOM?
A Production Plan is for manufactured items, which need a Bill of Materials. Get Items only returns items with an active BOM (is_active = 1); that is by design, not a bug. If a manufactured item is missing, check that its BOM is submitted and active.
Can I run production planning for a single Sales Order?
Yes. In the Production Plan, filter on that Sales Order (or its customer or item) when you get the Sales Orders, so only that order's items come in.
How do I handle multi-level BOMs in production planning?
After getting items, click "Get Sub Assembly Items" in the Production Plan. It explodes the BOMs and adds a row for each sub-assembly to make, and Work Orders are created for the sub-assemblies as well as the parent. The Sales Order counters sit on the top-level item.
Which ERPNext version does this guide apply to?
The formulas above are from the ERPNext v15 source (production_plan.py, read on 12 October 2026). Check the same file on your branch if you are on v14 or v16, as the planning code changes between major versions.
Production planning with partial production goes wrong because the Sales Order counters record what was planned or ordered, not what was made. Check the counters against the Work Orders, plan the shortfall deliberately with a note of why, and keep manual edits to ERPNext's counters out of the routine. The calculator and the debugger help you diagnose before you script.
Comments & ratings
No comments yet. Start a new discussion.
Manoj · Published on 4 August 2026
Worked with us? Leave a Google review