Hello All,
I want to generate a custom serial number series. The batch_no field already exists in the Serial No doctype, and I want to generate serial numbers using that field. For example, if the batch_no field has a value A024, the serial numbers should be created as A02401, A02402, and so on.
Currently, in the Test Item under the Inventory tab:
Batch No = 1
Automatic Create Batch = 1
Serial No = 1
Serial Number Series = batch_no.##
However, the system is not generating the serial numbers as I expect.
I have also tried using custom code, but it is not working — even the override method is not being called. If I leave the Serial Number Series blank, the system does not allow me to submit the stock entry and throws this error:
“Serial and Batch Bundle not set for item Test Item in warehouse Production - SL. If you want to auto pick serial bundle, then kindly set Serial No Series in Item Test Item.”
Can anyone provide a solution? This is very important and needs to be fixed immediately.
Thanks in advance.
Nivedha V
Any solution for this little urgent.
Thanks In Advance
Nivedha V
Hi @Nivedha
ERPNext offers you to control stock items on secondary level (other than item code and name) based on their nature either to be further tagged with Batch (if perishables) or Serial Number (incase high value non perishable goods).
In simple words, you cannot configure any stock item as batch or serialized at the same time. it has to be either one of those depending upon the nature of the item as stated earlier.
Batch or Serial number creation is very dynamic and can be set automatic depending on defined naming within item master or otherwise in stock setting globally. if not set auto, manual creation of batch or serial number is also an option.
Do you mean to say that an item cannot be both batch and serial? If yes then that is untrue.
In ERPNext v15 the Serial Number Series does not support dynamic field references (like using batch_no directly in the series).
Even though you have an item with Batch and Serial both enabled, ERPNext will generate serial numbers only if:
-
A static prefix or series is defined in Serial Number Series in the Item master, and
-
The item has Has Serial No checked, and
-
You are submitting a stock transaction that creates or receives stock (like a Purchase Receipt or Stock Entry).
ERPNext then creates the serial numbers automatically based on that series.
The reason your custom series batch_no.## is not working is because:
- ERPNext’s naming system for Serial Numbers does not evaluate field values like
batch_no as part of the naming series — it treats series formats as fixed prefixes followed by numbering.
If you leave the Serial Number Series blank, submission fails because v15 requires a series for auto-generation if you have enabled serial tracking for that item.
At this point, the options are:
-
Use a static series prefix like A024-.##### set in the Item master for that item, or
-
Create a Server Script that runs on before submit of the Purchase Receipt/Stock Entry and constructs the serial number manually by taking batch_no + padded count, and then assign them to the Serial and Batch Bundle via script.
Also an Item can have both batch and serial number