Cannot delete or cancel because Sales Invoice "***" is linked with Sales Invoice "***"

Hi. I created a new doctype to hold the item groups of the sales invoices. This doctype is a child of the sales invoice and when I try to delete a sales invoice document I get this message (Cannot delete or cancel because sales invoice ####-####-2022-00009 is linked to sales invoice #### -####-2022-00009). How I can avoid this? Thanks