On leave application, employee field also be read only for employee

On leave application, there is link field employee. I want that field to be as read only for employee login and goes to leave application.

This is also already be set when i open a page

Hi @Aditya_vig1,

If the user is an Employee, then it will go to the Leave Application then employee will set automatically and also set the read only.

Please apply the client script for it.

frappe.ui.form.on('Leave Application', {
	refresh: function(frm) {
        frappe.db.get_value("Employee", {
            "user_id": frappe.session.user
        }, ['name'],
        function (value) {
            if (value.name) {
                frm.set_value('employee', value.name);
                frm.set_df_property('employee', 'read_only', 1);

Then reload and check it.

Thank You!