Try ERPNext Buy Support Partners Foundation

Duplicate DocType does not work

I have made duplicate DocType employee renamed the new one emp1. The problem is there is a script worked on the original Doctype Employee (standard) and does not worked on new one

You must create the same script on the new doc type.

create a new custom script , and copy past the old script and change the doctype to the new one .

Even So It does not work !!!

please share your script,

frappe.ui.form.on(‘Employee’, {
refresh(frm) {
cur_frm.cscript.date_of_retirement = function(doc, cdt, cd){
cur_frm.set_value(“date_of_retirement”, frappe.datetime.add_years(doc.date_of_birth, 60));
}
frappe.msgprint(__(“TEST TEST TTT”));
// your code here
}
})
It works on Employee
My custom DocType (of course I changed in script the name of new custom DocType) does not work

frappe.ui.form.on(‘Emp’, {
refresh(frm) {
cur_frm.cscript.date_of_retirement = function(doc, cdt, cd){
cur_frm.set_value(“date_of_retirement”, frappe.datetime.add_years(doc.date_of_birth, 60));
}
frappe.msgprint(__(“TEST TEST TTT”));
// your code here
}
})
This is for custom DocType Emp . Does not work

at the first mail you said that the new doc type it emp1, so it must me like this in the script

frappe.ui.form.on(‘Emp1’, {
refresh(frm) {
cur_frm.cscript.date_of_retirement = function(doc, cdt, cd){
cur_frm.set_value(“date_of_retirement”, frappe.datetime.add_years(doc.date_of_birth, 60));
}
frappe.msgprint(__(“TEST TEST TTT”));
// your code here
}
})
This is f

no no I want to explain that I change the name of Doctype accordingly it is an example