I need to add a custom id (such as “1032”) to Customer. This id must be unique and incremental.
(Next new customer will get “1033” and so forth).
What is the best way to achieve this? Custom script?
How can I find out the next available customer id in a custom script?
Goto Setup → Selling —> Selling Settings —> Select Customer Name by Naming Series
There is no need for a custom script you can even change the Naming series by going to Setup —> Settings ----> Naming Series and select customer as below:
I hope that this helps.
Thank you for helping!
I know this is possible, but I wanted to avoid this since this will affect list views, print formats etc.
The integer id will only be used when interfacing other system we have.
Is it possible to use frappe.get_list and get the maximum value or something like that?
You will have to put in your custom app.
Add a hook to the
autoname method in
customer.py to define your own naming.
Just a thought: A universal way of solving this for any entry, document, field, etc. would be to incorportate a uuid that would be exposed in API’s, logs etc.
Solves m2m integrations. For quick manual entry/lookups, maybe a standardised “TLA” scheme (Three Letter Acronym) usually found in BOM/PLM systems.
TLA’s are constraints of systems, we prefer using full text search (on customer etc) as much as possible.