NEXEVES Mega Menu

Sales and Purchase Cycle in ERPNext: Technical Flow from Order to Accounting

 · 4 min read

Sales and Purchase Cycle in ERPNext – Technical Flow from Order to Accounting
ERPNext Illustration

Introduction

ERPNext handles Sales and Purchase not as isolated transactions but as a tightly connected business lifecycle. Each document created by users triggers validations, stock movements, tax calculations, and accounting entries behind the scenes.

A clear understanding of this flow is mandatory for ERPNext consultants, finance teams, and implementation engineers to avoid stock mismatches, incorrect profit calculation, and audit failures.

Business Transaction → Operational Document → Stock Ledger → General Ledger

1. ERPNext Sales & Purchase Architecture Overview

ERPNext follows a document-driven ERP architecture. Every business event is recorded as a DocType, and each DocType is responsible for a specific operational or accounting role.

Sales and Purchase cycles span across multiple modules, but all converge at the Stock and Accounts engines.

LayerRole
Selling / BuyingCommercial transactions
StockInventory movement & valuation
AccountsGL posting & financial impact
DocType Controller → validate() → on_submit() → Ledger Update

2. Lead and Opportunity – Pre-Sales Layer

Leads and Opportunities are pre-sales tracking documents. They help in forecasting revenue but do not impact inventory or accounting.

Lead → Opportunity → Quotation
DocumentStock ImpactAccounting Impact
LeadNoNo
OpportunityNoNo

3. Quotation – Commercial Proposal Logic

Quotation defines pricing, discounts, and taxes offered to a customer. ERPNext applies price list rules and validates item master data.

net_rate = price_list_rate - discount amount = net_rate * qty
FieldDescription
Price ListBase selling rate
Discount %Commercial concession

4. Sales Order – Contractual Control Document

Sales Order is the legally and operationally binding document. It controls delivery, stock reservation, credit exposure, and production planning.

Quotation → Sales Order → Delivery Note → Sales Invoice
SettingEffect
Reserve StockBlocks available quantity
Delivery DateMRP dependency

5. Customer Credit Limit Validation

ERPNext prevents over-selling by validating customer credit limit at Sales Order stage.

if outstanding_amount + order_total > credit_limit: frappe.throw("Credit limit exceeded")
ComponentIncluded
Outstanding InvoicesYes
Draft OrdersOptional

6. Pick List – Warehouse Execution Layer

Pick List translates Sales Orders into warehouse-level execution instructions. It helps identify exact bins and warehouses.

Sales Order → Pick List → Delivery Note
WarehouseAllocated Qty
Main Store8
Reserve Store2

7. Delivery Note – Physical Stock Movement

Delivery Note is the point where inventory actually moves out of the warehouse. Submitting it creates Stock Ledger Entries.

FieldValue
Actual Qty-10
WarehouseFinished Goods
SLE.actual_qty = -qty SLE.valuation_rate = calculated_rate

8. Stock Valuation and Cost of Goods Sold

ERPNext calculates valuation using FIFO or Moving Average based on item settings. COGS is derived automatically during delivery.

COGS = outgoing_qty × valuation_rate
MethodUsage
FIFOBatch-wise costing
Moving AverageWeighted costing

9. Sales Invoice – Revenue Recognition

Sales Invoice records revenue and customer receivable. It is the primary accounting document in the sales cycle.

AccountDebitCredit
DebtorsYesNo
IncomeNoYes

10. Sales Tax Calculation Logic

ERPNext supports multiple tax components, inclusive pricing, and item-wise tax rules.

tax_amount = net_total × tax_rate / 100 grand_total = net_total + total_tax

11. Accounts Receivable Lifecycle

Once invoiced, the amount remains outstanding until cleared via Payment Entry.

Invoice → Outstanding → Payment Entry
StatusMeaning
UnpaidOpen AR
PaidCleared

12. Sales Payment Entry

Payment Entry records cash or bank receipts and clears receivable balances.

AccountEffect
BankDebit
DebtorsCredit

13. Material Request – Demand Generation

Material Requests initiate procurement based on stock shortage or production demand.

TypePurpose
PurchaseExternal buying
TransferInternal movement

14. Request for Quotation (RFQ)

RFQ helps compare supplier pricing and lead time before finalizing a purchase.

SupplierRateLead Time
A1007 days
B9510 days

15. Purchase Order – Procurement Commitment

Purchase Order is a legal commitment to the supplier and controls quantity and price.

RFQ → Supplier Quotation → Purchase Order

16. Purchase Receipt – Stock Inflow

Purchase Receipt updates stock and creates incoming Stock Ledger Entries.

QtyIncoming Rate
20120

17. Landed Cost Voucher

Landed Cost Voucher distributes freight, customs, and insurance into item valuation.

allocated_cost = item_value / total_value × charges

18. Purchase Invoice – Liability Recognition

Purchase Invoice records supplier payable and accounting impact.

AccountDebitCredit
Expense / StockYesNo
CreditorsNoYes

19. Stock vs Expense Purchase Accounting

ERPNext posts accounting based on item type configuration.

Item TypePosting
StockInventory
ServiceExpense

20. Purchase Tax Handling

Supports input tax credit, reverse charge, and multiple tax templates.

input_tax_credit = tax_amount

21. Accounts Payable Lifecycle

Supplier invoices remain outstanding until Payment Entry is made.

Purchase Invoice → Outstanding → Payment Entry

22. Supplier Payment Entry

Payment Entry clears payable and credits bank or cash.

AccountEffect
CreditorsDebit
BankCredit

23. Document Traceability and Audit Trail

ERPNext maintains full document linkage for audits and troubleshooting.

SO → DN → SI → Payment PO → PR → PI → Payment

24. Period Closing and Reconciliation

Period Closing Voucher locks accounting periods and prevents backdated entries.

PurposeResult
Lock PeriodAudit safety

25. Common Issues and Best Practices

Most implementation issues arise from skipping standard document flow.

  • Always use Delivery Note for stock sales
  • Avoid direct Sales Invoice for inventory
  • Reconcile stock monthly
  • Validate item and account mapping

Conclusion

The Sales and Purchase cycle in ERPNext is a deeply integrated operational and accounting framework. Every document influences inventory valuation, taxation, receivables, payables, and profit.

A strong technical understanding of this flow ensures clean audits, accurate reporting, and scalable ERP implementations.


No comments yet.

Add a comment
Ctrl+Enter to add comment

NEXEVES Footer