Issue with "Cancel" in Workflow

Good Day Everyone,

In a standard Workflow, the Last Two states are “Approved” and “Cancelled”. In the “Approved” state the Doc Status is 1, and the “Cancelled” state the Doc Status is 2.
When testing the full workflow, at the “Approved” state, the Document is Submitted. Normally, the workflow ends at this state.
When canceling the Document in the workflow, at the “Approved” state, the Standard “Cancel” Button appears, and the “Actions” Button appears as well. Inside the Actions Button, an action called “Cancel”.
When clicking the standard “Cancel” Button, The Workflow state remains the same at “Approved” state, (Even when removing the “Cancel” State and Action Doesn’t work) and clicking the Action Button “Cancel”, a message appears (Illegal Document Status for Cancelled).
When clicking the Actions Button “Cancel”, it works perfectly.
P.S. I tried to remove the “Cancel” Permissions in order to use the Action Button instead of using the Standard “Cancel” Button, but it didn’t work.

How to use the Action Button “Cancel” without removing the Permissions for “Cancel”?

Thank You

3 Likes

having the same issue, when click the standard action ‘cancel’ button, doc is cancelled but the state is still showing ‘Approved’.
Did you find any solution for this?

1 Like

Just fixed this. :slight_smile:

https://github.com/frappe/frappe/pull/7169

1 Like

Hi,

Im using the v11 version with already come up with the hotfix above but still having the same issue .

Currently for temp fix i need to add those hide script at the doctype affected .

v14- I have some sales order that were cancelled but they are still showing as valid orders back-end because the DOCUMENT STATUS = SUBMITTED

How can I change the document status = CANCELLED?

In my experience, this happens when you cancel a Submitted document through the drop down menu (…). The Document Status changed to “2” but the workflow_state incorrectly stays as “Submitted” or other workflow_state that have Document Status of 1. In the workflow doctype, untick the “Don’t Override Status” so you can view the Document Status correctly (Draft, Submitted, Cancelled).

To correct, I added in the States: State: Cancelled, Doc State=2, Update Field=workflow_state, Update Value=“Cancelled”. Then I also added in the Transition Rules: State=Submitted, Action=Cancel, Next State=Cancelled. What happens now is that those with workflow_state of “Submitted” will have in the Action menu “Cancel”. Selecting this corrects the workflow_state to “Cancelled”