Default "Batch no" value in the Purchase Receipt

I want to make possible that batch no is predifined in the field when creating Purchase receipt. Maybe any suggestion how to do that?
Thanks in Advance!

Do you want the batch no. to be auto created? If so, check this link: Item and check the " Automatically Create New Batch". You will have to set this in the item master for the batch number ot be created automatically in the Purchase Receipt.

Hope this helps.

hi Michelle, thanks for the answer.

No, I don’t want to create them automatically.

My issue is following… We have something about 500 items and for now they have only one batch. What I want to do is when I am creating purchase receipt to fetch automatically that desired batch. So I don’t have to click and choose them. Just want to be visible as default in the “batch no” field.

I hope you understand what I mean.

Hi grgiciva,

Welcome to ERPNext. Hope you have a great experience using/working with ERPNext.

Okay, try this. Go to Customize Form - Purchase Receipt Item, Find Batch Number and open up that Line and in Default value add the Batch Number. ERPNext expects you to have a different Batch Number for each Item, so your best bet is to use Custom Script and Concatenate the Item Code and the Standard Batch Number that is common across all items.

Like let’s say you have Items ItemA, ItemB and ItemC. Let’s the the Standard Batch you want is BatchX. So, you write a bit of script to insert ItemA-BatchX as the batch for Item A. ItemA-BatchX as the batch for ItemB and so on.

I’m curious as to why you want to track Batch Number in the first instance, but then want to have the same Batch (say BatchX) across all items.

If you state the business reason why you are wanting to do this, maybe there is an easier way of achieving your business purpose than what are trying to do.

Hope this helps.



Hi Jay,
thanks for the fast answer.

No, we don’t want/have only one batch number for all items, every item has their own batch but only one per item.

e.g. when I am creating purchase receipt there is 100 items in the table and currently I have to manually choose batch number for each item. I just want to avoid manual work and possibility that batch is automatically added to the field, so I can just submit document and that is all.


Hi Ivan,

Maybe you can maintain a DocType. Or add a Custom Field in the Item Master and link it to the Batch Number. And after that with a custom script, you should be able to pull it automatically into your Purchase Receipts.

Again: Curious to know why you would want to track Batch Numbers but have a single batch for each item. Batch Numbers help you achieve traceability. But if you have a single batch number, you can have the Item Code as the Batch Number.

Are you expecting the Batch Number to change in the future. Is it more like Revision Numbers or something? Just curious.

Hope this helps.



Hi Jay,
we made a quick solution with a custom script and now everything is fine, so thanks for advice.

Regarding your question, we will have more than one batch number in the future, this is just temporary solution until we add all products and their batch numbers,

thanks anyway and sorry for late answer.

Br, Ivan