Can't delete linked doctype in ver13

I am facing below issue while cancel my doctype “Costing RM Price”. I wrote code to cancel the linked doctpe “Finished Goods Price” on before_cancel event. but its not firing
Cancel All Documents
Costing RM Price CRMP0001 is linked with the following submitted documents:

Finished Goods Price: FGP-FG-A-2021-11-29-USD
You do not have permissions to cancel all linked documents.

Any update?