fix(workflows): populate doc in apply_workflow whitelisted method #21068
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
apply_workflow
method infrappe.model.workflow
consistently fails right now. The problem is accurately described here: #11883The fix was applied to the
get_transitions
method, but it was never applied toapply_workflow
. As a consequence, theapply_workflow
method sends an "empty" document toget_transitions
, which leaves the current workflow state undefined and throws an exception here:https://github.com/frappe/frappe/blame/c643d4a33cc58d10c0a3d81c9ed9df9bf6cc0776/frappe/model/workflow.py#L57
Asking
apply_workflow
to load from the db solves this problem.