Unable to Cancel or Delete Submitted Custom Submittable DocType

I am facing an issue with a custom DocType in Frappe/ERPNext.

Environment

  • Custom DocType: DocOps

  • Is Submittable: Enabled

Issue

I have created a custom DocType named DocOps and marked it as Submittable. After submitting a document, I want to cancel or delete it.

However:

  • There is no “Cancel” button available in the form.

  • When I try to delete the document, I get an error stating that the document must be cancelled before it can be deleted.

  • I am logged in as Administrator.

  • There are no active workflows on this DocType.

  • I have already verified that workflow restrictions are not causing the issue.

So I am stuck in a situation where:

  1. The document cannot be cancelled because there is no Cancel option.

  2. The document cannot be deleted because it is submitted.

What I Have Already Checked

  • DocType is marked as Is Submittable

  • Logged in as Administrator

  • No active Workflow exists for this DocType

  • Tried after disabling all workflows

  • Refreshed/reloaded the form

Expected Behavior

Submitted documents should display a Cancel action (for users with sufficient permissions such as Administrator), allowing the document to be cancelled and then deleted if required.

Question

Has anyone encountered this issue with a custom submittable DocType?

  • Is there any additional DocType setting required to enable the Cancel action?

  • Could this be a bug in Frappe v16?

  • Are there any permission or controller methods that could prevent the Cancel button from appearing even when the DocType is submittable?

Any guidance would be greatly appreciated.

Hi @spathakvincular.in

Please define role permission manager for your custom doctype.

Hi @spathakvincular.in

Can you go to Framework → Build → DocType → DocOps → Permissions

Add system manager with Cancel ticked

Hope it helps

Hi @asieftejani

Thank you for your reply I tried your approach but still I am facing the same issue.

Hi @ahsantareen

Thank you for your reply. I tried your approach, but I am still facing the same issue. Is there any other way to delete these records?

The Cancel button for a submittable DocType is not controlled only by the Is Submittable flag. In Frappe, the Cancel action appears only when the document is in Submitted state (docstatus = 1) and the current user has the required permissions.

A few things to check:

  1. Check Cancel permission

    Go to:

    Role Permissions Manager → DocOps → Cancel

    Make sure the Administrator role (or the user role) has Cancel permission enabled.

  2. Verify the document status

    Check the document value:

    docstatus = 1
    
    

    If the document is not actually submitted, the Cancel button will not appear.

  3. Check the DocType controller

    If you have a custom Python controller for DocOps, make sure you have not overridden any methods that affect cancellation, for example:

    def on_cancel(self):
        pass
    
    

    or custom validation that prevents cancellation.

  4. Check client scripts

    A Client Script or custom JS can hide actions from the form. Search for code like:

    frm.remove_custom_button("Cancel");
    
    
  5. Try clearing cache

    After changing permissions or DocType settings:

    bench clear-cache
    bench restart
    
    

Regarding Frappe v16: this is not generally a known bug. The standard behavior is still that submitted documents show Cancel if the user has Cancel permission. In most cases with custom DocTypes, the missing Cancel button is caused by missing permissions, custom scripts, or controller customizations.

You can also test quickly from the console:

doc = frappe.get_doc("DocOps", "DOC-NAME")
print(doc.docstatus)
print(frappe.has_permission("DocOps", "cancel", doc=doc))

If the second value is False, the issue is permission-related.