Knowledge Base updated: 2026-11-22
ERPNext knowledge base
ERPNext is a Frappe application for operational ERP workflows: selling, buying, inventory, manufacturing, projects, CRM, and accounting.
Its main domain logic lives under erpnext/<module>/doctype/, with document controllers coordinating validation, lifecycle state, stock effects, and accounting effects. Shared services and reports supplement those document workflows.
Critical business state is persisted in Frappe DocTypes, especially transactional documents, Stock Ledger Entries, General Ledger Entries, and linked child rows. Client-side form scripts complement—not replace—server-side validation and posting.
System map
flowchart TD
UI[Frappe Desk and Web UI] --> DOC[ERPNext DocTypes]
DOC --> SELL[Selling]
DOC --> BUY[Buying]
DOC --> STOCK[Stock]
DOC --> MFG[Manufacturing]
DOC --> SUB[Subcontracting]
DOC --> PROJECTS[Projects and Support]
DOC --> CRM[CRM]
SELL --> ACC[Accounts]
BUY --> STOCK
BUY --> ACC
STOCK --> ACC
MFG --> STOCK
SUB --> STOCK
DOC --> DB[(Frappe database)]
ACC --> GL[General Ledger]
STOCK --> SLE[Stock Ledger]
flowchart LR
SO[Sales Order] --> DN[Delivery Note]
DN --> SI[Sales Invoice]
SI --> PE[Payment Entry]
SO --> RES[Stock Reservation]
DN --> SLE[Stock Ledger Entries]
SI --> GL[General Ledger Entries]
PE --> GL
flowchart LR
PP[Production Plan] --> WO[Work Order]
WO --> JC[Job Card]
WO --> SE[Stock Entry]
SE --> SLE[Stock Ledger Entries]
WO --> FG[Finished Goods]
Glossary
- DocType: Frappe's persisted document model and its server-side controller.
- Stock Ledger Entry (SLE): an inventory movement record used to determine stock quantities and valuation.
- General Ledger Entry (GLE): an accounting posting record generated by submitted financial and stock transactions.
- Stock Entry: a stock movement document for transfers, manufacture, consumption, receipts, and related inventory operations.
- Repost Item Valuation: queued recalculation work that rebuilds affected stock and accounting valuation effects.
Codebase-wide invariants
- Submitted accounting transactions produce ledger effects through server-side document logic; client scripts are not the source of truth. Evidence: erpnext/…/journal_entry.py and erpnext/…/sales_invoice.py.
- Stock-affecting documents must preserve stock-ledger consistency before related accounting effects are finalized. Evidence: erpnext/…/stock_entry.py and erpnext/…/gl_composer.py.
- Transaction status is derived and maintained by document services rather than being a freely editable workflow label. Evidence: erpnext/…/status.py and erpnext/…/status.py.
- Manufacturing execution connects planned demand to material movements through production plans, work orders, and stock entries. Evidence: erpnext/…/production_plan.py and erpnext/…/work_order.py.
- Reconciliation and reposting workflows exist to repair or recompute derived operational state rather than directly editing ledger history. Evidence: erpnext/…/repost_item_valuation.py and erpnext/…/stock_reconciliation.py.
Routing table
erpnext/accounts/**-> docs/accounting-and-finance.mderpnext/accounts/doctype/journal_entry/**-> docs/financial-transaction-posting.mderpnext/accounts/doctype/{sales_invoice,purchase_invoice,payment_entry}/**-> docs/financial-transaction-posting.mderpnext/accounts/doctype/{bank_transaction,bank_transaction_rule,bank_reconciliation_tool}/**-> docs/banking-and-reconciliation.mderpnext/selling/**-> docs/sales-and-commerce.mderpnext/selling/doctype/{quotation,sales_order}/**-> docs/sales-fulfillment.mderpnext/stock/doctype/delivery_note/**-> docs/sales-fulfillment.mderpnext/accounts/doctype/pos_*/**-> docs/point-of-sale-and-subscriptions.mderpnext/accounts/doctype/subscription*/**-> docs/point-of-sale-and-subscriptions.mderpnext/buying/**-> docs/procurement-and-suppliers.mderpnext/buying/doctype/{material_request,request_for_quotation,supplier_quotation,purchase_order}/**-> docs/purchase-to-pay.mderpnext/stock/doctype/purchase_receipt/**-> docs/purchase-to-pay.mderpnext/stock/doctype/{item,warehouse,stock_entry,landed_cost_voucher}/**-> docs/inventory-and-warehouse.mderpnext/stock/doctype/{stock_reconciliation,repost_item_valuation}/**-> docs/stock-valuation-and-reposting.mderpnext/stock/doctype/{pick_list,serial_and_batch_bundle,reorder_level}/**-> docs/inventory-replenishment-and-traceability.mderpnext/manufacturing/**-> docs/manufacturing-and-subcontracting.mderpnext/manufacturing/doctype/{bom,production_plan,work_order,job_card}/**-> docs/production-planning-and-execution.mderpnext/subcontracting/**-> docs/subcontracting-operations.mderpnext/crm/**-> docs/customer-relationship-management.mderpnext/crm/doctype/{lead,prospect,opportunity,appointment}/**-> docs/lead-to-opportunity.mderpnext/projects/**-> docs/projects-and-support.mderpnext/projects/doctype/{project,task,timesheet}/**-> docs/project-delivery-and-timesheets.md- erpnext/hooks.py -> docs/application-lifecycle-and-extensions.md
erpnext/setup/**-> docs/application-lifecycle-and-extensions.mderpnext/patches/**-> docs/application-lifecycle-and-extensions.md