Is there way to make child table field readonly base on condition for particular row


I want to make rate field readonly for first row and editable for second row base on condition. Condition is if item group is service rate must be editable and for other it should be readonly as rate is predefined.

I tried following way from custom script but it makes all row readonly
var df1 = frappe.meta.get_docfield(“Child Table Name”,“field_name”, cur_frm.doc.name);
df1.read_only = 1;

It would be best if we have option like Display Depends On within every field for readonly (Readonly Depends On) property. I tried display depends on using some value of that particular row of child table , it worked perfectly and it does not affect second row.

Good news, there is a “Read Only Depends On” field. Look one or two sections below “Display Depends On”.

which version? M using version 12 and it is not there

‘Readonly depends on’ does not work for fields in child table grid.

Here is my patched solution, until there is a better way to do it.

cur_frm.fields_dict.child_table.grid.grid_rows[row_no].docfields[field_idx].read_only=1
cur_frm.fields_dict.child_table.grid.refresh()

You can trigger this code on any field events.

Hello @Ponnusamy_V

I have a use case where I want the entire row on a child table to be read only immediately one of the field changes to paid