Skip to main content

ERPNext how-to & fixes

ERPNext Stock Ledger vs General Ledger: Fixing the Perpetual Inventory Gap (2026)

Your Stock Balance report and Stock-in-Hand account don't match. Size the gap, find the cause (a stray journal, a repost, a mapping) and close it.

Updated 12 Oct 202611 min readBy ManojFirst published 27 Jul 2026

Under perpetual inventory, ERPNext keeps one rule: the value in your Stock Ledger equals the balance of your stock accounts, because every stock movement posts a matching General Ledger entry. When that breaks, and the Stock Balance report says one number while the GL says another, it is not random. It is a stray Journal Entry, a repost that hasn't finished, backdated entries into a closed period, or a warehouse mapped to the wrong account. This guide sizes your gap and traces it to its cause.

A Stock Ledger that disagrees with the General Ledger slowly wears down trust in an ERPNext system, because if stock value is wrong, so is COGS, and so is gross margin. I am Manoj, and I lead ERPNext and Frappe programmes at MithTech, a team of Frappe specialists in Bengaluru. Closing this gap is one of the most common accounting jobs our team takes on with inherited instances.

How is perpetual inventory supposed to behave?

With perpetual inventory enabled, ERPNext posts a General Ledger entry for every stock transaction: a receipt debits Stock-in-Hand, a delivery credits it and debits COGS, and so on. The official documentation states the rule plainly: the value as per the Stock Ledger should always equal the relevant account balance. So the Stock Balance report total and the Stock-in-Hand account in the GL are two views of the same number.

When they disagree, something posted to one side without the other. That is the diagnosis, and it narrows to a short list of causes.

How do you quantify the gap?

Before chasing anything, measure it. A ₹20 difference on ₹25 lakh of stock is rounding; a ₹2 lakh difference is a broken entry. Put in your two totals for a banded read.

CalculatorGap Calculator

Enter your Stock Ledger value and Stock-in-Hand GL balance to see the gap, its percentage of stock value, and whether it's rounding or a real break.

Gap

₹20,000

As % of stock value

0.80%

Read

Investigate

A real but small gap. Check for a stuck repost or a stray Journal Entry to a stock account before it grows.

How do you trace it to the cause?

The Stock-vs-GL gap has a short list of causes, and they have very different fixes. Pick the one that fits what you know happened.

InteractiveStock-vs-GL Cause Decider

Select the most likely reason your Stock Ledger and General Ledger disagree to get its cause and the specific fix.

Pick the most likely reason your two balances disagree.

Is it a manual Journal Entry?

Most Stock-vs-GL breaks trace to one action: someone posted a Journal Entry straight to the Stock-in-Hand account, to "adjust" a balance, to book a write-off, or to correct something they didn't understand. Perpetual inventory keeps the account tied to the ledger by only ever posting from stock transactions. A manual JE moves the accounting side alone, and the two never realign on their own. The fix is to reverse the JE and make the adjustment through a Stock Entry or Stock Reconciliation instead, so both sides move together.

Is a repost still running?

If a backdated transaction queued a Repost Item Valuation that hasn't finished, the Stock Ledger values are mid-recalculation while the GL still shows the old numbers. This disagreement is expected until the repost completes, so before treating a gap as a break, confirm no repost is Queued, In Progress or Failed. If one is stuck, clear it first; our Repost Item Valuation guide covers it.

Did stock post into a closed period?

Stock posted into a period whose accounts were already closed leaves the ledger and the GL out of step for that window, because the GL repost may be skipped for the closed period, the pattern reported in discuss.frappe.io #134791. This is the one case where a journal adjustment may be the right answer, so decide it with your accountant: reopen the period and let the repost post, or book a reviewed adjustment in the current period and record why.

Is a warehouse mapped to the wrong account?

If a warehouse is mapped to the wrong account, or several warehouses share one Stock-in-Hand account that also holds unrelated balances, the account total won't line up with any single warehouse's ledger (#15148). Give stock warehouses their own accounts and compare like-for-like.

How do you close it, then keep it closed?

Code recipeVariance · Repost · Prevent Recipes

Quantify the mismatch with the variance report, realign via reposting, and prevent the drift from recurring.

Find exactly which entries differ before you touch anything.

text
Report:  Stock Ledger Variance
         (Stock > Reports > Stock Ledger Variance)
It lists Stock Ledger Entries whose stock value doesn't
match the linked GL Entry — your shortlist of culprits.
Cross-check against:
  • Stock Balance report  (stock-side total)
  • General Ledger for the Stock-in-Hand account (GL side)
The difference between those two totals is what you're closing.
1

Run the comparison reports

Stock > Reports > Stock and Account Value Comparison lists the vouchers whose stock value doesn't match their accounting entry: your shortlist, instead of a mystery total. Stock Ledger Variance shows Stock Ledger Entries whose quantity or value is inconsistent with the entries before them, which a repost usually fixes.

2

Rule out a pending repost

Check Repost Item Valuation for anything not Completed. If a repost is running or stuck, the gap may close once it finishes; clear stuck ones first and let the queue drain.

3

Find and reverse improper journal entries

Pull the General Ledger for the Stock-in-Hand account and look for Journal Entries; anything not coming from a stock transaction is suspect. Reverse them and re-do the adjustment through a Stock Entry or Stock Reconciliation.

4

Fix mappings and re-verify

Confirm each warehouse's account mapping is correct and unique where it should be. Then compare the Stock Balance total with the Stock-in-Hand GL balance again; they should now agree within rounding.

Should you fix it now, or monitor it?

Trace and fix nowMonitor / accept
The gap is material and growingThe gap is a few rupees and stable (moving-average rounding)
A manual JE to a stock account is visible in the GLA repost is mid-run and expected to realign it
Margins / COGS reports depend on the stock valueThe difference rounds to noise on your P&L
You're heading into a statutory auditYou've just fixed it and are watching it hold

At a glance

Fix
Manual Journal Entry to a stock accountJournal Entries in the Stock-in-Hand GLReverse it; adjust through Stock Entry or Stock Reconciliation
Repost not finishedRepost Item Valuation not CompletedClear stuck reposts and let the queue finish
Stock posted into a closed periodGap limited to a closed periodDecide with your accountant: reopen, or a reviewed adjustment
Wrong warehouse-to-account mappingAccount total matches no warehouseGive each stock warehouse the right account
RoundingTiny, stable differenceLeave it

FAQ: what do people ask most?

+Why doesn't my ERPNext Stock Ledger match the General Ledger?

Under perpetual inventory the two should always agree, so a difference means something posted to one side without the other. The usual causes are a manual Journal Entry to a stock account, a valuation repost that hasn't finished, backdated entries into a closed period, or a wrong warehouse-to-account mapping. Run the Stock and Account Value Comparison report to find the specific vouchers.

+How do I fix a Stock-in-Hand account that doesn't match my stock value?

Size the gap, then run the Stock and Account Value Comparison report to list the mismatched vouchers. Rule out a pending repost, reverse any Journal Entry posted directly to the stock account, and correct warehouse-account mappings. Re-do adjustments through Stock Entry or Stock Reconciliation so both sides move together.

+Can I post a Journal Entry to fix a stock account balance?

Usually not; that is what causes most mismatches in the first place. A Journal Entry moves the General Ledger without a matching Stock Ledger movement, so the two permanently diverge. Adjust stock value through a Stock Reconciliation or Stock Entry, which post to both sides together. The exception is a gap stuck in a closed period, which your accountant should decide.

+Is a small difference between stock ledger and GL normal?

A tiny, stable difference under moving-average valuation can be genuine rounding on individual movements and is usually immaterial. A difference that grows over time is not rounding; it points to a manual journal entry, backdated entries, or a stuck repost, and should be traced.

+Does reposting fix a stock ledger vs GL mismatch?

It fixes the part caused by backdated entries: once every Repost Item Valuation is Completed, the stock-side values realign for open periods. It will not fix a mismatch caused by a manual Journal Entry or a wrong account mapping; those need reversing and correcting directly.

+Which report shows me the mismatched entries?

Stock and Account Value Comparison (Stock > Reports) lists the vouchers whose stock value doesn't match their accounting entry. Stock Ledger Variance shows Stock Ledger Entries that are inconsistent with the entries before them. With the Stock Balance total and the Stock-in-Hand balance in the GL, they turn a mystery total into a specific shortlist.

+Does this apply to ERPNext v14, v15 and v16?

Yes. Perpetual inventory posts to the GL on every movement, and the causes of a Stock-vs-GL gap are the same across v14, v15 and v16. Report names and a few UI paths differ slightly by release.

What is the bottom line?

Perpetual inventory only works if you respect its one rule: stock value changes through stock documents, never through direct journal entries to stock accounts. When the Stock Ledger and the General Ledger drift apart, quantify the gap, shortlist it with the variance report, and trace it to the stray entry or the pending repost behind it. Fix the cause, keep the rule, and the two numbers stay together, which is the only state in which your COGS and margins mean anything.

Your next step

Stock value and books drifting apart and month-end is a fight?

See it live

Low stock reorders itself

Stock dips below minimum, suppliers quote in their portal, and the chosen one gets the order.

You end with a purchase order sent · 4 screens · about 6 min

No sign-up, no card, no account.

Next step · ERPNext how-to & fixes

Now see what an audit finds in yours

When the same problems keep coming back, tick what you see and get an audit of the ERPNext you have, then fixes in order of what costs you most.

Comments & ratings

No comments yet. Start a new discussion.

0

Manoj · Published on 27 July 2026

Worked with us? Leave a Google review

Questions about this? Talk to the team.

Book a 30-minute Google Meet, WhatsApp us, or send a message. The engineer who works on this replies.

Send us a message
Your details go to our team's CRM and are used only to reply.