Not able to delete Leave Allocation entries


I have some Leave Allocation entries which are in ‘submitted’ state which I want to delete. I know that if I can cancel them, then they can be deleted. But the problem is that I do not see the ‘Cancel’ button.

Possible reason is -

I want to achieve something where I can replace ‘From date’ and ‘To date’ with a single entry ‘Fiscal Year’ by customizing doctype, so that users should not need to select date ranges, rather they select a specific no. of leaves be allocated to all employees for a fiscal year. The plan is to hide the From date and To date (as they can not be removed), make them non mandatory, add ‘Fiscal Year’ field and then add a custom script which internally sets To date (1st April of current year) and From date(31st March of next year) when fiscal year is selected.

As per above plan I was doing the necessary changes in the system and it seems this ended up with following issues:

Now, when I access the single page of a leave allocation, it shows the ‘Update’ button instead of ‘Cancel’. Even if I click on it, it says ‘Mandatory fields required in Leave Allocation To Date’. when I make this field non mandatory via ‘Customize Form’ for Leave Allocation doctype and the error changes to ‘Not allowed to change From Date after submission’. I notice that all of my entries which were submitted without To date but they have From date set somehow and the date gets updated every day. The date update make sense in case of new entries but not sure why it is happening for submitted entries.

Currently, the system has started working fine i.e. I am no longer able to make entry without From and To date (which somehow happened in last case). Even it works with my custom script.
But I can’t figure out a way to delete the old unstable entries.

Is it recommended to remove them from DB? If I do so, will it cause any inconsistency in the system? OR is there any other way to overcome this problem?

If I must remove them from DB, can anyone please share the steps as I do not want that action to cause any inconsistency in the system.

I am using -
ERPNext: v6.21.0
Frappe Framework: v6.22.0

Any suggestions would be greatly appreciated.

Thanks in advance!!!

Check if you have Cancel permissions

There is ‘Cancel’ permission to the user but the ‘Cancel’ button does appear on the leave allocation page.

Check if there is an error in the javascript console.

Do you have any customization in Leave Allocation? Perhaps a workflow or
custom script?

No error.
I was trying something for leave control panel but removed everything. The functionality works fine now. I am able to see ‘Cancel’ button for new entries but the problem is that I am not able to remove some older entries as ‘Cancel’ button doesn’t appear for them. Reason could be that they contain inconsistence data i.e. somehow, ‘To Date’ is not set for them and they are in submitted state.