Apply read only mode for the newly added child row

Hi,

I am trying to apply read only mode for the added child row. Please advise.

frappe.ui.form.on("Stationery Item Information", {
  item_list_add(frm, cdt, cdn) {
    
    // adding values from the parent to child table 
    console.log(frm.doc.workflow_state);
    let row = locals[cdt][cdn];
    row.category = frm.doc.category;
    row.sub_category = frm.doc.sub_category;
    row.item_name = frm.doc.item_name;
    row.unit = frm.doc.unit;
    row.max_qty = frm.doc.max_qty;
    row.stock_qty = frm.doc.stock_qty;
    row.required_qty = frm.doc.required_qty;
    row.approved_qty = frm.doc.approved_qty;
    frm.set_value("required_qty", null);
    // frm.set_df_property('item_list', 'read_only', 1, frm.docname, 'approved_qty', row.name);
    frm.refresh_field("item_list");
    // setreadonly(frm,cdt,cdn);
  },

This reference help you

1 Like

xxxx means for wht? is it child table field name

Read only doesn’t work when the field is in the “Is list view” using the client script; it only works when you click on the edit button and open the item form.