Retain sample stock
Sample stock is a small quantity from a batch that you keep for tests later, for example when a customer reports a quality problem. You can retain samples of raw materials, packing materials, and finished goods.
ERPNext moves the samples into a sample retention warehouse with a Material Transfer Stock Entry. The samples stay linked to their batch.
Prerequisites
- A warehouse for samples only. Do not use it for production or sales. It cannot be a group warehouse.
- The Item has Has Batch No selected.
Set up sample retention
- In Stock Settings, select the Sample Retention Warehouse.
- Open the Item. In the Serial Nos / Batches section, select Retain Sample.
- Enter the Max Sample Quantity: the most units that you keep from one batch.
- Save the Item.

Retain a sample when you receive stock
- Create a Purchase Receipt, or a Stock Entry of type Material Receipt or Manufacture.
- In the row of the Item, select or create the batch, and enter the Sample Quantity. It cannot be more than the received quantity.
- Submit the document.
- Select Create > Sample Retention Stock Entry. ERPNext opens a new Material Transfer Stock Entry from the receiving warehouse to the sample retention warehouse, with the batch and the sample quantity.
- Check the Stock Entry and submit it.
If the batch already has samples in the retention warehouse, ERPNext reduces the quantity so that the total stays within Max Sample Quantity. If the batch already has the maximum, ERPNext does not add a row and shows a message.
Troubleshooting
| Message | Cause | Fix |
|---|---|---|
Sample quantity <n> cannot be more than received quantity <m> | The Sample Quantity is more than the row quantity. | Lower the Sample Quantity. |
Maximum Samples - <n> have already been retained for Batch <batch> | The batch already has the maximum samples in the retention warehouse. | No action is needed. To keep more, raise Max Sample Quantity on the Item. |