Manage batches ​

A batch is a group of units of an Item that share properties, for example one production lot. Each batch has a Batch ID, a manufacturing date, and an optional expiry date. ERPNext keeps the stock of each batch in each warehouse.

Use batches for Items with expiry dates or lots, for example medicines, food, and chemicals. Every stock transaction of a batched Item must name the batch.

Prerequisites ​

Set up an Item for batches ​

  1. Open the Item. In the Serial Nos / Batches section, select Has Batch No.
  2. To let ERPNext create batches on receipt, select Automatically Create New Batch. Then, optionally, enter a Batch Number Series, for example MED-.#####.
    • If Batch Number Series is blank, ERPNext uses the Naming Series Prefix from Stock Settings when Have default Naming Series for Batch ID? is selected there. Otherwise it creates a random ID.
    • If Automatically Create New Batch is clear, you create each batch by hand before you receive it.
  3. To track expiry, select Has Expiry Date and enter the Shelf Life In Days. ERPNext sets the expiry date of each new batch from its manufacturing date and the shelf life.
  4. Optionally, select Retain Sample to keep a sample of each batch. See Retain sample stock.
  5. Save the Item.

Create a batch by hand ​

  1. Open the Batch list and select Add Batch.
  2. Enter the Batch ID and select the Item.
  3. Optionally, set the Manufacturing Date (default: today), the Expiry Date, and the Batch Description.
  4. Save the batch.

Item form with Has Batch No and Automatically Create New Batch selected

Receive Items in a batch ​

In a Purchase Receipt or a Stock Entry of type Material Receipt or Manufacture:

  • With Automatically Create New Batch on the Item, leave the batch blank. ERPNext creates a new batch when you submit.
  • Otherwise, select an existing batch in the row's Batch No field, or in the serial and batch selector if Use Serial / Batch fields is clear in Stock Settings.

The batch records the source document and, for a purchase, the supplier.

Deliver or issue Items from a batch ​

In a Delivery Note, Sales Invoice with Update Stock, or Stock Entry, select the Batch No in the row. The Batch No list shows only batches of the Item that have stock in the row's warehouse and have not expired on the posting date. For a Product Bundle, select the batch in the Packing List table.

With Auto create Serial and Batch Bundle for outward selected in Stock Settings (default), you can leave the batch blank. ERPNext picks batches on submit, in the order of Pick Serial / Batch Based On: FIFO, LIFO, or Expiry.

Move or split a batch ​

Open the batch. The Stock Levels section shows the quantity of the batch in each warehouse, with two buttons on each line:

  • Move: select the To Warehouse. ERPNext creates and submits a Material Transfer Stock Entry for the batch quantity in that warehouse.
  • Split: enter the New Batch Qty and, optionally, a New Batch ID. ERPNext creates a new batch with this batch as its Parent Batch, and moves the quantity with a Repack Stock Entry.

Batch form with stock levels by warehouse and the Move and Split buttons

Other buttons on the batch:

  • View Ledger: opens the stock ledger of the batch.
  • Recalculate Batch Qty: recalculates Batch Quantity from the stock ledger.

Batch status ​

The Batch list shows the status of each batch:

StatusMeaning
ActiveThe batch has stock.
EmptyThe batch has no stock.
ExpiredThe expiry date has passed.
DisabledDisabled is selected on the batch. ERPNext does not let you use it.

Batch valuation ​

By default, each batch has its own valuation rate: ERPNext values stock that leaves a batch at the incoming rate of that batch. The batch shows this as Use Batch-wise Valuation.

If the Item uses the moving average method and Do not use Batch-wise Valuation is selected in Stock Settings, new batches use the moving average of the Item instead. You cannot clear that setting after any Serial and Batch Bundle is submitted. Learn more about valuation methods.

Reports ​

  • Batch-Wise Balance History: opening, in, out, and closing quantity of each batch in each warehouse for a period.
  • Batch Item Expiry Status: the expiry date and remaining days of each batch.
  • Serial and Batch Traceability: the raw materials and customers of a batch.
  • Negative Batch: batches with negative stock.

Troubleshooting ​

MessageCauseFix
Batch ID is mandatoryThe Item has no Automatically Create New Batch, and the batch has no ID.Enter the Batch ID, or select Automatically Create New Batch on the Item.
The selected item cannot have BatchHas Batch No is clear on the Item.Select an Item with Has Batch No.
The Batch <batch> of an item <item> has negative stock in the warehouse <warehouse>The transaction takes more than the batch has on that date.Receive the missing quantity first. If a back-dated entry causes it and you cannot fix it, select Allow Negative Stock for Batch in the batch, then correct the stock soon.