Set the field as Read Only after saving

in Sales Person Doctype, I want to Set the Employee field as Read Only after saving for document.

Does anyone have an idea how this can be done?

You need to create a custom script.
And use the cur_frm.set_df_property method which is used to update the display of the field…

frappe.ui.form.on(“MyDocType”, “refresh”, function(frm) {
// use the is_new method of frm, to check if the doc is saved or not
frm.set_df_property(“myfield”, “read_only”, frm.is_new() ? 0 : 1);
}

Please check https://docs.erpnext.com/docs/v14/user/manual/en/customize-erpnext/client-scripts/make-read-only-after-saving#:~:text=Only%20After%20Saving-,Make%20Read%20Only%20After%20Saving,-Use%20the%20method

1 Like