Make child table read-only after workflow status changes

make child table read-only after workflow status changes, from apply to approved. doctype is not submitable. i have 3 step workflow, apply-verify-approved.

so i want to make transaction read only after approved.

i used below code, but when i reload the page it dose-not work. only sometime working

frappe.ui.form.on(“Appraisal Work Plan”, “goals_on_form_rendered”, function(frm, grid_row, cdt, cdn){
var grid_row = cur_frm.open_grid_row();
if(frm.doc.workflow_state === “Approved”){
grid_row.grid_form.fields_dict.kra.df.read_only = true;

try below:
frm.set_df_property("items", "read_only", 1);



below code is working.

frappe.ui.form.on(“Work Plan Review”, “onload”, function(frm, grid_row, cdt, cdn){
if(frm.doc.workflow_state === “Accepted”){
var df = frappe.meta.get_docfield(“Appraisal Plan Goals”, “kra”,;
df.read_only = 1;