Hi,
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?
Thanks
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:
https://frappeframework.com/docs/user/en/basics/doctypes/naming#by-document-naming-rule
For naming series, a straight forward client script should do the trick.
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: cur_frm.cscript.company = function(doc, cdt, cdn){
//function(frm){
// this function is called when the value of company is changed.
if(cur_frm.doc.company=== 'Demo India Pvt. Ltd.'){
cur_frm.set_value("naming_series","PO/ABC/.###");
}
else if(cur_frm.doc.company == 'Test India Pvt. Ltd.'){
cur_frm.set_value("naming_series","PO/XYZ/.###");
}
}
});
Hope this will help. Thanks -Suresh
2 Likes