Workflow Transition from Draft to Cancelled

Hello Everyone,

I have a question regarding Workflow transition, how can I configure a transition from state with docstatus = 0 to state with docstatus = 2 (example state Draft to Cancelled)? Previously, this was not possible, but from this feat: Discard transactions by rutwikhdev · Pull Request #25971 · frappe/frappe · GitHub , it can now be done using the discard action, but it is also noted that the discard action becomes hidden when a workflow is active..

I would appreciate it if someone could explain how to configure this..

PS: I’ve looked in the documentation, git, or discussions, but haven’t found it yet. And I use v16.

The key constraint you’re running into is that the new discard action lives outside the workflow engine, so an active workflow replaces those buttons with your own transition menu. On v16, the practical route is to make a workflow transition whose next state carries docstatus 2 and let the workflow action handle cancellation, rather than relying on discard. If the transition still won’t apply, check whether the state’s docstatus is set to Cancelled and whether the transition is allowed from the current state for your role. If that path is blocked in your build, submitting an issue with your workflow JSON would help confirm whether it’s a bug or intended.

Thank you for your response.

So, essentially, there are two types of processes: those without a workflow and those with one. Previously, for both types, a process could not be cancelled before being submitted. Now, a “discard” button is available for processes that do not use a workflow. Conversely, if a workflow is enabled, the system enforces the validation rule: “Cannot be cancelled before submission” (I have verified this). As you mentioned, “this new ‘discard’ action exists outside the workflow engine; therefore, when a workflow is active, these buttons are replaced by the transition menu that you have defined.” My question is: is there a specific setting or an alternative method that would allow for cancellation—particularly before submission—while a workflow is active, yet still adheres to the established workflow transitions?

Workflow Example:
State:

  1. Draft → 0
  2. SPV Approval → 0
  3. Manager Approval → 0
  4. Approved → 1
  5. Cancelled → 2

Transition:

  1. Draft → Request → SPV Approval
  2. Draft → Cancel → Cancelled
  3. SPV Approval → Approve → Manager Approval
  4. SPV Approval → Reject → Draft
  5. Manager Approval → Approve → Approved
  6. Manager Approval → Reject → Draft
  7. Approved → Cancel → Cancelled

PS: I have already granted the necessary access for the relevant role to perform cancellations.