Batch number problem of subcontracted items

Hello everybody,

We are at the stage of implementing ErpNext and what we have observed so far is satisfactory. Even though i am quite happy with ErpNext, i am having some issues. One of which is about batch numbers. Let me explain the situation here.

Material-01 has a BoM which only has Material-02 in it.

Material-01 is subcontracted. I need to send Material-02 to the supplier for them to process. Afterwards what i get from the supplier, becomes Material-01. I would like to trace both Material-01 and Material-02 by assigning them batch numbers.

Everything works perfect until i try to receive Material-01 from the supplier. I am able to send Material-02 with batch no, let’s say “batch01”. When i would like to receive Material-01 from the supplier, system warns me to assign a batch number (this is what i want, i need to know which batch i use in my BoM’s in production). When i assign a batch number, let’s say, “batch02” to incoming material, i receive an error:

“batch02” is not a valid Batch Number for Item Material-02

“batch02” is a batch number for Material-01 actually. The only solution seems not using batch numbers for one of the items. But in this case i loose traceability. I am stuck here. Can anybody help?

Shouldn’t you be trying to use serial number (auto generated along with a combination of batch?) , Batch number should be unique ideally and I think you are trying to use the same batch number for two different items.

Hello Pawan,

No, i don’t want to use serial numbers here. As you said i was trying to use the same batch number for two different items, but unintentionally.

But i found the cause of the problem. When i try to receive the subcontracted item, Material-01, i define the batch number for that batch. ErpNext does not show me the supplied raw material information on the screen (Section - Raw Material Supplied). After i save the Purchase Receipt, a table appears under this section which shows me the material i receive and also the material i have supplied. When i go to the details of the row, i see that the batch number of Material-01 is assigned automatically to the raw material info. This should be the batch number of the raw material i supplied to the supplier, in this example it should be “batch01”. But system automatically inserted number “batch02”.

This is the mistake which needs to be checked.

To have better control on this, I would suggest you create a Batch linked to each of the raw material items( E > Stock > Batch ), this way when you create a purchase receipt against a sub contracted Item you would be prompted by a validation to enter the correct Batch.

Just to be sure, i tried again from the beginning. As you said, the raw materials already have a defined batch number before the transaction. But the error continues. System auto-assigns a wrong batch number as i explained in my last post (hope that was clear enough to understand).

If you have set up the batch correctly, you should get an error. Also, I assume you are on the latest version of ERPNext

I am using the latest version.

I assign a batch number for a specific item received on a specific day (or order). Here are the screenshots of the problem. I have supplied M0003 to the supplier to process and prepare M0002 for me.

I receive the error because ErpNExt assigned the batch number of item M0002 (batch no: M0002-041016 in this example). But it should be batch number of item M0003 as it is the raw material i’ve supplied.

I hope it is more clear now. Am i missing something?

Resurrecting an older thread.

We are experiencing the same problem as above.

Item 1 - consists of 2 sub items (item 1-1, item 1-2) that are sent out for assembly.
Item 1 has batch number.

To be honest we dont really want batch numbers on item 1-1 or item 1-2 but…

When assigning batch number to item 1 when it arrives, the system automatically assigns the same batch number to the raw materials (item 1-1, item 1-2). If I then delete the batch number assigned it reinserts and argues it needs a batch number.

So I recreate item 1-1 & item 1-2 with batch numbers and the same thing happens that the raw materials are automatically assigned the same batch number as the finished item (and you system doesn’t even allow duplicate batch numbers on different parts). It is possible after receiving the error to go into raw materials list and change the batch to the correct one but it should not insert the batch number of the finished item automatically into the sub parts.

Any advise?


Am also encountering the same.

When a non-batch item is used as a raw material to a subcontracted batch item, during purchase receipt, the system will require a batch number to the non-batch raw material. Looks like there is an error/bug on this. Kindly check.

Or should we are missing anything on the setup, kindly advise us what to do?


Okay, let me submit a Github issue on this and see if we can assign some resources to solve this issue.

Thanks for bringing this up and for your patience.


I have submitted the github issue on this. Till it gets implemented, one possible workaround is for you to do Material Issue and Material Receipt till then. Just add a custom field and link it to Supplier and a SQL Report should be able to help you build the report that shows how much stock is left with your Sub Contractor.

I understand it is not an elegant solution as you need to load the costs manually and is prone to errors, but please give us sometime to fix this issue.

Here’s the github issue if you want to track it’s progress:



Thanks a lot, Jay!


I have the same problem, I’m afraid after 2.5 year the problem wasn’t fix.
Some one have a solution ?

Thank you