Item Code automated generation support? Overhaul of existing item codes?

Hi!! I have recently joined a company which has used ERPNext since 2007. Unfortunately, due to lax regulations and flaunting of conventions, our stock inventory (both old stock and new orders) has been a huge hodgepodge which has only grown exponentially as the years went by.

In light of this, I am proposing to overhaul the existing item numbering system and implement a newer and better system of identification and ordering to suit our inventory. The features of the system are:-
1.) Automated item code generation by scripting and assignment of codes based on approval of employee.
2.) New algorithm of item code generation (Originally we used 9 digits but I want to try and extend the number of digits to possibly 12 or more)

Now my question is two-fold:-
a.) Can a single field in ERPNext have a script attached to it to fill in values based on a boolean input from the user (i.e. Yes or No)? If not, what options can I use for my above problem?
b.) What is the MAXIMUM possible number of bits I can use for item codes, as per ERPNext limitations?

Regards,

Hello,

Thanks for elaborating your query. Inline replies below.

a.) Can a single field in ERPNext have a script attached to it to fill in values based on a boolean input from the user (i.e. Yes or No)? If not, what options can I use for my above problem?

AFAIK you should be able to manage this using Custom Script. Check the following link to learn how to write a Custom Script for the Item Code generation.

https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/generate-item-code-based-on-custom-logic

b.) What is the MAXIMUM possible number of bits I can use for item codes, as per ERPNext limitations?

Item Code is a Data field which has the characters limit of 140.

1 Like

Thanks a lot, umair. The sample custom script gives me an idea of how to take things forward with automation.
Also, I did not know that item code field is a data field. Does that mean it is a String entry? If it is a String and not numerical (integeral) then that might pose a problem for doing data analyses further down the line because sorting via item codes will be taxing on our systems.

Thanks!!

Though it is a string, if you have Item Code generated based on numerics only, you will be able to sort it as required.

In the case of string, it it will be A - > Z.
In the case of numbers, it will be 1 - > ∞

and vice-versa.

2 Likes