#59070·erpnext

Feature Request: Prevent cancellation of a document when linked documents are in Draft status

Author: ManishaNasreenCreated Sep 15, 2026Updated Sep 17, 2026
Labelsfeature-requestUnder Review

Before Submitting

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. As a [role], I have to [painful task] because [missing feature].

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Impact

  • Blocks critical workflow — no viable workaround
  • Significant friction — workaround exists but is painful
  • Nice to have — minor improvement

Additional context Add any other context or screenshots about the feature request here.

Environment

  • ERPNext Version:

  • Frappe Version:

  • Deployment:

    Is your feature request related to a problem? Please describe.

Currently, ERPNext's standard cancellation check only prevents cancelling a submitted document if it is linked to another submitted document (docstatus = 1). It does not check whether any linked/dependent document is still in Draft status (docstatus = 0).

This creates a gap: a user can cancel a parent document even though a dependent document that references it is still sitting in Draft, potentially leaving orphaned or inconsistent draft records behind (e.g. a Draft Delivery Note referencing a Sales Order that then gets cancelled).

Describe the solution you'd like

When a user attempts to cancel a submitted document, the system should:

  1. Check for any linked/dependent documents (using the existing linked-document detection logic already used for submitted-document checks).
  2. Check the docstatus of those linked documents.
  3. If any linked document is found in Draft status, block the cancellation.
  4. Show a clear validation message identifying the blocking document(s) — ideally reusing/extending the existing standard message shown for linked submitted documents (e.g. "Cannot cancel this document as it is linked with submitted document {0}"), adapted to also cover Draft-linked documents.
  5. If no linked documents are in Draft status, cancellation proceeds normally as today.

Ideally this would be a configurable option (e.g. controlled via a setting or a doctype-level flag) rather than hard-coded behavior, so it can be enabled selectively for relevant document types (Sales Order, Purchase Order, etc.) without affecting doctypes where this check isn't desired.

Describe alternatives you've considered

  • Writing a custom before_cancel validation via a Server Script / custom app for each relevant doctype. This works but has to be replicated per doctype/site and isn't a standard, maintained solution.

Additional context

  • Confirmed that the current linked-document check (check_if_doc_is_linked / check_if_doc_is_dynamically_linked in the Frappe framework) only evaluates docstatus = 1 (submitted) linked records, not docstatus = 0 (draft) records.
  • Requesting confirmation from maintainers on whether this is intentional design (to avoid blocking cancellation on freely-editable drafts) or something that could be extended, and whether an opt-in setting would be acceptable.

App/Version: Frappe Framework v15.118.0 (HEAD), ERPNext v15.119.3 (HEAD)