Cannot delete Purchase Invoice even if it's cancelled

I’m new to ERPNext and did some test run by adding items and making some fake purchase entries. I want to remove the test entries (because some of the items included in the test purchase entry need to be modified using the same item code like UOM), but deletion is locked due to Payment Ledger entries.

How do I delete a purchase invoice properly?

Hi,

Is it possible to cancel any payments linked to the invoice?

https://docs.erpnext.com/docs/user/manual/en/journal-entry

@sugilmath Once Purchase Invoice has been created, a Ledger entry has been added and its cannot be deleted. To modify entry, you need to cancel the Purchase Invoice first then amend it.

If you really want to delete/remove data, then can do it from Company. But It will delete all transactions which is done using the Company.