ERPNext

ERPNext

Batch has negative stock, but the batch shows stock

The error

You see one of two messages when you submit or cancel a document, for example a Delivery Note, Sales Invoice, Stock Entry or Purchase Receipt.

The batch has no stock at the posting date and time of this document:

Batch No MX6-26-0001 of Item PASTE-MX6-4G has negative stock of quantity -20.0 in the warehouse Stores - FD

The message for a backdated Delivery Note when the batch had no stock at that time

This document makes a later entry of the batch negative:

The Batch MX6-26-0001 of item PASTE-MX6-4G has negative stock in the warehouse Stores - FD as of 08-04-2026 10:00:00. Please add a stock quantity of 10.0 to proceed with this entry. If it is not possible to make an adjustment entry, please enable 'Allow Negative Stock for Batch' in the batch MX6-26-0001 or in the Stock Settings to proceed.

The Negative Stock Error when a backdated entry makes a later entry negative

Other error texts for the same problem:

  • 10.0 units of Item PASTE-MX6-4G: Arctic MX-6 Thermal Paste 4 g needed in Warehouse Stores - FD on 2026-04-08 10:00:00 for Delivery Note … to complete this transaction.
  • The Batch MX6-26-0001 has negative batch quantity -10.0. To fix this, go to the batch and click on Recalculate Batch Qty. If the issue still persists, create an inward entry.

Why this happens

ERPNext checks batch stock at the posting date and time of each transaction, in each warehouse. The batch must have enough stock at every point in its history, not only today.

The Batch form shows the Batch Qty for today, for all warehouses together. So a batch can show stock today and still be short at an earlier time, or in one warehouse.

There are two cases:

  • No stock at the time of this document. You post an issue dated before the receipt of the batch, or you cancel the receipt that the issue used. You get the short "Batch No … has negative stock" message.
  • A later entry loses its stock. This document has stock at its own time. But it takes stock that a later issue already used. You get the Negative Stock Error. The date in the message ("as of …") is the date of that later entry.

A wrong batch or warehouse on the item row gives the same errors.

For example, 100 tubes of thermal paste arrive in batch MX6-26-0001 on 5 April 2026. On 8 April, 80 go out on a Delivery Note. 20 remain.

  • A delivery of 20 dated 3 April fails: on 3 April the batch had nothing yet.
  • A delivery of 30 dated 6 April fails too. On 6 April the batch had 100. But the 8 April delivery of 80 then needs 10 more than is left. The error says "as of 08-04-2026" and "add a stock quantity of 10".

How to fix it

1. Find the transaction that makes the batch negative

If the error has a date ("as of …"), the entry on that date is the one that goes negative. For stock that is already negative, use the Negative Batch Report:

  1. Go to Stock → Reports → Negative Batch Report.
  2. Select the Company, and the Item Code or Warehouse if you know them.
  3. Click Generate New Report. The report runs in the background.
  4. Look at the row for the batch. Posting Datetime, Document Type and Document No show the first transaction where the batch went below zero. Previous Qty shows what the batch had before.

The Negative Batch Report with one row: the 8 April Delivery Note takes the batch from 70 to -10

To see the batch quantity at each date, open the Stock Ledger report and filter by the Batch No and Warehouse.

2. Check the failing document

On the document that fails, check:

  1. Date and Posting Time. Is the date before the receipt of the batch? To change them, select Edit Posting Date and Time first.
  2. Warehouse on the item row. Is it the warehouse that holds the batch?
  3. Batch No on the item row. Open the row with the edit icon. If Use Serial No / Batch Fields is on, the Batch No is in the Serial and Batch No section. If it is off, open the Serial and Batch Bundle and check the Batch No and Qty there.

The item row of a Delivery Note with the Warehouse and Batch No marked

3. Correct the entries

Do the fix that matches what you found:

  • The date is too early. Change the posting date and time to after the receipt of the batch. If the document is submitted, cancel it, amend it, correct the date and submit it again.
  • A receipt was cancelled or changed. Restore the receipt, or cancel the later issues of that batch first. Then make the change.
  • Wrong batch or warehouse. Select the correct Batch No or Warehouse, then submit.
  • The stock was really there, but not recorded. Make a Stock Entry of type Material Receipt or a Stock Reconciliation for the batch, dated before the entry that goes negative. Use the quantity the error asks for.
  • The Batch Qty is wrong. If the error says "Recalculate Batch Qty", open the Batch and click Recalculate Batch Qty.

4. Repost the stock values

A backdated change recalculates the stock values of all later entries. ERPNext does this in the background with a Repost Item Valuation entry.

  1. Go to Stock → Repost Item Valuation.
  2. Check that the entry for your item has the status Completed.
  3. If no entry exists, make a new one. Select Based On = Item and Warehouse, the Item Code, the Warehouse and the earliest Posting Date you changed. Then submit it.

Allow Negative Stock and batch items

The Allow Negative Stock setting in Stock Settings does not let a batch go negative.

From ERPNext v15.97.0 and v16.5.0, there is a separate setting, Allow Negative Stock for Batch. You can turn it on in Stock Settings for all batches, or on one Batch. It has limits:

  • It only helps when the document makes a later entry negative (the Negative Stock Error with "as of …"). A document with no batch stock at its own time is always blocked.
  • The item-level check still applies. You also need Allow Negative Stock on, or you get "… units of Item … needed in Warehouse …".
  • The batch's total quantity today can not go below zero.

Use it only when you can not make a correcting entry, and fix the stock soon. Negative batch stock gives wrong valuation rates.

How to prevent it

  • Post receipts before issues. Avoid backdated issues of batch items.
  • Before you cancel or amend a receipt of a batch, check the later issues of that batch in the Stock Ledger.
  • Check the batch and warehouse on the item row before you submit.

If this does not fix it

Raise a support ticket. Attach:

  • A screenshot of the full error message.
  • The Negative Batch Report rows for the batch.
  • The Stock Ledger report for the batch and warehouse.
  • The name of the failing document and the site name.
Last updated 2 hours ago
Was this helpful?
Thanks!