Item naming series based on selected group

I want that ERPNext uses naming series from item group.
Every group will have own series(eg. Group 1 has series 001…####, Group 2 has series 002…####).

In item group doc I’ll set naming series field where user will select naming series from select list.
What should I do in Item doctype?


I think a good place to put code for this is in the python item controller’s def autoname:

I’m not sure which frappe function to use.
I believe it can be done from UI, with scripts.

Have you tried achieving this via Document Naming Rule:

For naming series, a straight forward client script should do the trick.

Sorry, I don’t use v13.

Okey, but I want to hide Series field while creating the item.
Client should pick selected series from item group. So when I select item group, client automatically selects series.
Only I don’t know is what should I write to client script

Hi, @Pararera, I have applied custom script on Sales Invoice based selection of company.
Please make series field Read only from customize sales invoice


frappe.ui.form.on("Sales Invoice", {
 company: = function(doc, cdt, cdn){
// this function is called when the value of company is changed.
if( 'Demo India Pvt. Ltd.'){
else if( == 'Test India Pvt. Ltd.'){

Hope this will help. Thanks -Suresh