Sales Order issue

Dear all

at Rate field
I Changed the field permission to Read only but I need it to be editable when I change the type of document from sales to maintenance

Thanks

Try something like this:

if doc.parenttype == "Maintenance":
   cur_frm.set_read_only();