Skip to content
Back to skills

Frappe Workflow

ASecurity

Frappe/ERPNext Workflows and approvals. Use when designing or fixing a Workflow - states, transitions, approval chains, roles, conditions, docstatus mapping, or applying workflow actions in code.

  • 10 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 24, 2026
ai-agentspythongo

Works with

  • terminal

Security analysis

A100/100

Scanned November 24, 2026

npx -y skills add irfanzahoor/frappe_core_skills --skill frappe-workflow --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Frappe Workflow?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Frappe Workflow
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/irfanzahoor-frappe-workflow/badge)](https://www.skillsdirectory.com/skills/irfanzahoor-frappe-workflow)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: frappe-workflow
description: Frappe/ERPNext Workflows and approvals. Use when designing or fixing a Workflow - states, transitions, approval chains, roles, conditions, docstatus mapping, or applying workflow actions in code.
---

# Frappe Workflow

## Design first
1. List every stage (Draft, Pending Manager, Approved, Rejected, Cancelled).
2. Give each state a `doc_status`: 0 = draft/editable, 1 = submitted, 2 = cancelled.
3. Give each transition: Action, Next State, Allowed role, optional Condition.

## Rules
- There must be a state with docstatus 0. New docs start there.
- docstatus only moves forward: 0->0, 0->1, 1->1, 1->2. Never go from submitted back to draft, and never transition out of cancelled.
- **Intermediate approval states stay at docstatus 0.** Only the final "Approved" state is 1.
- Rejected is usually docstatus 0 (so it can be edited and resubmitted), or a terminal 0 state.
- Conditions use `doc.fieldname`: `doc.grand_total > 100000`, `frappe.session.user == doc.owner`.
- `allow_self_approval = 0` when the creator must not approve their own doc.
- Set the "Workflow State" field (`workflow_state`). Don't drive state with a custom Select field.
- Workflow is for **who may move a doc**. Put business validation in controller `validate` / `before_submit`.
- Ship the workflow from the app as a **fixture** (`Workflow`, `Workflow State`, `Workflow Action Master`).

## In code
```python
from frappe.model.workflow import apply_workflow, get_transitions
apply_workflow(doc, "Approve")           # respects roles/conditions
get_transitions(doc)                      # actions available to current user
```
Never set `doc.workflow_state = ...` directly to skip approvals.

## Debug
- Button missing: check the user's role, the transition condition, `allow_self_approval`, and that the workflow is active (only one active per DocType).
- "Not allowed to change state": the role is missing on the transition.
- Emails for workflow actions: enable "Send Email Alert" on the workflow, and check Email Account / Email Queue.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.