Setting default in Form gets overridden

Using Installed Apps
ERPNext: v10.1.76 (master)
Frappe Framework: v10.1.68 (master)

Generally we order most things from our own country so when using Purchase Orders, I want the Taxes & Charges field to be pre-filled with our normal UK tax code, and this can be changed if required.

To do this I have done ‘Customise’ form on the Purchase Order form so that the default for this field (taxes_and_charges) is set to the correct tax code which is brought in by the Purchase Taxes and Charges Template.

When creating a new PO, the correct code is set by default, but only until the Supplier is selected when the Taxes & Charges field is set back to blank.

I can’t see anything on the Suppliers details that should affect the Tax field in the Purchase Orders form, and wonder what is breaking this for me.

Does anyone know how I can set a default tax rate that doesn’t get changed in our PO’s? Or do I need to change something in the Supplier’s details to allow the default to stick.

If you want to keep default value and prevent any functions called when supplier is selected.
You can create custom script with code below.

erpnext.utils.get_party_details = function(){
	console.log("keep default value");
}

I know it’s not ideal solution. You can find functions below, you may have a better solution.

when the Supplier is selected it triggers function below

then this

and this