How to disable mandatory field?

Purchase order field in my doctype set as a mandatory field as well as mandatory depends on

eval: doc.entry_type == "Purchase Receipt"

Now I want to hide this field and change the disabled mandatory field using JavaScript like this:

frm.toggle_display("purchase_order", false);
frm.set_df_property("purchase_order", "reqd", 0);

so it will hide successfully but when I submit my form that time an error occurs for the purchase order being a mandatory field.
How can I hide the purchase order field using JavaScript?