help please I want to restrict chaild attach file to pdf only :(

this code below can’t take effect on the attach feild , I need U to help me to fix it with frappe v15 devolope
frappe.ui.form.on(‘tparento’, {
onload_post_render: function(frm) {
// Debug log for parent form
console.log("Form loaded: ", frm.doc);

    // Ensure the child table exists
    const child_field = frm.fields_dict['t_empo'];  // Replace 't_empo' with your child table field name
    if (child_field && child_field.grid) {
        console.log("Child table found: ", child_field);

        // Access the file field using fields_map
        const attach_field = child_field.grid.fields_map['t_file'];  // Replace 'file_field_name' with your file field name
        if (attach_field) {
          attach_field.on_attach_click = function () {
              	attach_field.set_upload_options();
		attach_field.upload_options.restrictions.allowed_file_types = [
			"application/pdf",
		  //   "image/png",
			"text/pdf",
			"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
			
		];
		
		attach_field.file_uploader = new frappe.ui.FileUploader(attach_field.upload_options);
	
              
              
          }
        }
    }
        
       
}

});