Hello Guys,
Could you please advise if it is possible to generate random digits only in naming series or any other way.
Thank you
Abduljaleel
Hello Guys,
Could you please advise if it is possible to generate random digits only in naming series or any other way.
Thank you
Abduljaleel
I would say yes that is doable -
Possibly this library 9.6. random — Generate pseudo-random numbers — Python 2.7.18 documentation might work, where the integer sequence does not repeat. You may want to browse frappe/naming.py at develop · frappe/frappe · GitHub
As you say, a server side script with the naming_series you require that implements the ‘autoname’ method for the SalesOrder DocType.
It’s doable. By combining @clarkej random python library and the autoname function you won’t have to do any checking for duplicate names, though you’ll need to error handle it I think.
Here’s how I approached it - take out the business logic and drop in the randomization function.
Hi @abduljalyl, Let me walk you through how I’d approach this. You’ll need beginner python skills and some patience.
before_insert
function to:self.meaningful_name = frappe.model.naming.make_autoname(name_key, self, self)
Good luck and post your results back here so that others can benefit from your efforts.
Thank you very much, I will try it and get back to you.
Abduljaleel