Multiple items with same item code gives error

Hi everyone,

I’m facing an issue with handling items that have the same Item Code across multiple companies, and I would appreciate your help in resolving it.

Let me explain the scenario in detail.

Some of my clients uses EFRIS (Uganda Compliance), and I have implemented a functionality that allows them to directly fetch items from EFRIS into our system, i.e., ERPNext.

The challenge arises because multiple clients and companies can have items with the same generic numeric Item Code, such as 01, 001, etc.

To handle this, I implemented a check in my code that generates a unique Item Name by prefixing the Item Code with the Company Abbreviation whenever the Item Code is numeric.

For example:

  • Company Abbreviation: GNS
  • Item Code: 001
  • Item Name: GNS-001

This approach solves ERPNext’s uniqueness constraint, as every Item document must have a unique name.

However, it introduces another issue when creating a Sales Invoice. When I add this item to the Item table and try to save the invoice, ERPNext throws an error stating that GNS-001 does not exist.

My understanding is that, internally, ERPNext might be trying to fetch the Item document using its name field instead of its item_code. This could be because ERPNext generally assumes that the Item Name and Item Code are the same, whereas, in my case, the Item Code is 001 and the Item Name is GNS-001.

My question is:

Is there a recommended way to handle this scenario in ERPNext, where multiple companies can have items with the same Item Code but different Item Names, without causing issues when creating transactions such as Sales Invoices?

I would appreciate any suggestions or guidance on how to approach this.

I’m also attaching supporting screenshots for better understanding.

Thanks in advance!

Hi @NeelBrahmbhatt

Why not make the name as per your unique Item Name. I think this can be achieved by implementing a server script or changing the naming series in the customize form

Hope it helps