Role wise child table field show readonly

Hello Community,!

can we set read-only on the field of the child table as per role?

Thanks in Advance.

Hi @Darshit_Patel,

Please apply custom/client script.

frappe.ui.form.on("Sales Order",{
    before_load: function(frm) {
        var df = frappe.meta.get_docfield("Sales Order Item", 'rate',;
        if (frappe.user.has_role('Sales User') == 1) {
            df.read_only = 1;

We set the read-only field on the rate. so please check it.

Please set the doctype and field name which you use, your according.

Thank You!

before_onload: function(frm) {
        var df = frappe.meta.get_docfield("Task Calculation", 'start_date_and_time',;
         if (frappe.user.has_role('Projects User') == 1) {
            df.read_only = 1;

Same as but that is not work

Hmm :thinking:,

Please try in data field type, for testing.

I have a similar problem. Could you please take a look at my topic?