Skip to main content
Back to Blog

How ERPNext Connects Sales, Purchase, Inventory and Accounting: Complete Flow

Understand how ERPNext integrates sales, purchase, inventory and accounting modules. Complete workflow with examples and benefits.

Star Tech Team16 May 202615 min read
How ERPNext Connects Sales, Purchase, Inventory and Accounting: Complete Flow

How ERPNext Connects Sales, Purchase, Inventory and Accounting: Complete Flow

The Problem: Disconnected Systems

Most companies use separate tools:

  • Sales: Custom CRM or spreadsheet
  • Purchasing: Email + Excel
  • Inventory: Manual stock counting
  • Accounting: QuickBooks or manual GL entries

Result:

  • Data discrepancies (GL shows QAR 50k inventory, physical count shows QAR 35k)
  • Month-end close takes 5–7 days
  • No visibility into profitability by customer/product
  • Manual GL entries cause errors (4–6% error rate typical)

The Solution: Integrated ERPNext Workflow

One system, one database, automated flow:

Sales Order → Delivery → Invoice → GL Entry
     ↓          ↓           ↓          ↓
 Purchase ← Stock → Cost → Profit Report
 Order  Update  Calculation

Complete Workflow: From Sale to Accounting

Step 1: Sales Order Created

When: Customer order received Who: Sales person What: Create Sales Order (SO) in ERPNext

Data Input:

Sales Order #001
├─ Customer: ABC Trading
├─ Items:
│  ├─ Product A: Qty 100 @ QAR 50 = QAR 5,000
│  ├─ Product B: Qty 50 @ QAR 100 = QAR 5,000
└─ Total: QAR 10,000

Automatic Actions:

  1. Inventory Check: ERPNext checks stock availability

    • Product A: 150 available (OK)
    • Product B: 30 available (short 20 units)
  2. GL Preview: Revenue GL prepared (not posted yet)

    • Sales Revenue Account: +QAR 10,000
    • Accounts Receivable: +QAR 10,000
  3. Purchase Trigger: If stock low, auto-suggest purchase order

    • Product B: Purchase 50 more units

Step 2: Delivery Note Created

When: Goods shipped to customer Who: Warehouse staff What: Create Delivery Note from SO

What ERPNext Does:

  1. Stock Deduction (Inventory Journal created):

    Warehouse: Main Store
    ├─ Product A: Qty -100 (leaves 50)
    ├─ Product B: Qty -50 (leaves -20, i.e., back-order)
    
  2. Cost Calculation:

    Product A Cost = Qty 100 × Standard Cost (QAR 35) = QAR 3,500
    Product B Cost = Qty 50 × Standard Cost (QAR 70) = QAR 3,500
    Total COGS = QAR 7,000
    
  3. GL Entry (Inventory Adjustment):

    Debit: Cost of Goods Sold (COGS): QAR 7,000
    Credit: Inventory Asset: QAR 7,000
    
  4. Stock Aging:

    • Product A FIFO: Used 100 units from batch dated 2025-03-01
    • Cost linked to batch for traceability

Step 3: Sales Invoice Created

When: Ready to bill customer Who: Finance team What: Create Sales Invoice from Delivery Note

GL Entries Created (automatically):

Journal Entry #GL-001
├─ Debit:  Accounts Receivable (ABC Trading): QAR 10,000
├─ Credit: Sales Revenue: QAR 10,000
├─ Debit:  COGS: QAR 7,000
└─ Credit: Inventory: QAR 7,000

Result: Gross Profit = QAR 10,000 - QAR 7,000 = QAR 3,000 (30%)

Accounting GL Snapshot:

Accounts Receivable: +QAR 10,000
Sales Revenue: +QAR 10,000
COGS: +QAR 7,000
Inventory: -QAR 7,000

Step 4: Purchase Order (Triggered by Low Stock)

When: Stock falls below reorder point Who: Procurement team What: Create Purchase Order for Product B (20-unit shortfall)

ERPNext Auto-Generates:

  • PO to Supplier "Chemical Supplies Inc."
  • Qty: 50 units @ QAR 75 = QAR 3,750
  • Expected delivery: 2025-06-01
  • GL prepared (not posted yet):
    Debit: Inventory: QAR 3,750
    Credit: Accounts Payable: QAR 3,750
    

Step 5: Purchase Receipt (Goods Received)

When: Supplier delivery arrives Who: Warehouse staff What: Create Purchase Receipt from PO

GL Entry Created (Goods Receipt):

Debit: Inventory (Product B): QAR 3,750
Credit: Accounts Payable: QAR 3,750

Stock Update:

Before: Product B = -20 (back-order)
After:  Product B = +30 (back-order fulfilled + 30 surplus)

Cost Valuation:

  • New batch cost: QAR 75/unit
  • Previous batch cost: QAR 70/unit
  • Weighted average cost updates automatically

Step 6: Purchase Invoice (from Supplier)

When: Supplier invoice received Who: Accounts Payable team What: Match invoice to PO receipt (3-way match)

3-Way Match (Quality Control):

1. PO (promised): Qty 50 @ QAR 75 = QAR 3,750 ✓
2. Receipt (delivered): Qty 50 arrived ✓
3. Invoice (billed): Qty 50 @ QAR 75 = QAR 3,750 ✓
→ Match! Auto-approve for payment

If Mismatch:

  • Invoice qty = 48 (not 50) → Hold, request clarification
  • Invoice price = QAR 78 (not QAR 75) → Hold, dispute with supplier

GL Entry Created:

Debit: Accounts Payable: QAR 3,750
Credit: Cash: QAR 3,750
OR
Credit: Accrued Expenses (if payment deferred)

Complete Transaction Summary

General Ledger (GL) Final State

Account                          Debit        Credit
────────────────────────────────────────────────────
Accounts Receivable (ABC)        QAR 10,000
Sales Revenue                                QAR 10,000
COGS                             QAR 7,000
Inventory (Product A sold)                   QAR 3,500
Inventory (Product B sold)                   QAR 3,500

Inventory (Product B purchased)  QAR 3,750
Accounts Payable (Supplier)                  QAR 3,750

Cash (Supplier payment)          QAR 3,750
Accounts Payable                             QAR 3,750
────────────────────────────────────────────────────
Totals                           QAR 24,500  QAR 24,500

Profit & Loss Impact

Sales Revenue:                   QAR 10,000
 Less: COGS                       (QAR 7,000)
────────────────────────────────────────────
Gross Profit:                    QAR 3,000 (30% margin)

Operating Expenses:              (QAR 1,500)
────────────────────────────────────────────
Net Profit:                      QAR 1,500

Balance Sheet Impact

Before Transaction         After Transaction
────────────────────      ────────────────────
Inventory: QAR 50k        Inventory: QAR 45.75k
                          (QAR 50k - 3.5k + 3.75k - 3.5k)
AR: QAR 0                 AR: QAR 10k
AP: QAR 0                 AP: QAR 0 (paid)
Retained Earnings: QAR 0  RE: QAR 1.5k (profit)

Key Benefits of Integration

1. Data Accuracy

  • Single database = no discrepancies
  • Example: Inventory GL matches physical inventory 99%+ accuracy

2. Real-Time Profitability

  • Know margin on each customer/product immediately
  • Example: ABC Trading = 30% gross margin, Supplier X = QAR 500/unit cost

3. Faster Month-End Close

  • Before: 5–7 days (manual GL entries, reconciliation)
  • After: 1–2 days (GL auto-created, reconciliation automated)

4. Inventory Valuation Accuracy

  • Automatic FIFO/weighted-average cost calculation
  • Example: Product A batch from March 2025 used first (FIFO)

5. Cash Flow Visibility

  • Know exactly when cash hits (supplier payment dates)
  • Predict cash flow 3–6 months out
  • Example: Supplier terms 30 days = cash leaves June 1, not May 1

6. Compliance & Audit Trail

  • Every GL entry linked to source document (SO, PO, Receipt)
  • Auditors can trace QAR 1 from invoice to GL to payment

Common Customizations

Multi-Currency Transactions

Customer in USD, Supplier in AED, GL in QAR
ERPNext handles FX conversion automatically
Example: USD 100 @ 3.64 QAR/USD = QAR 364

Multi-location Inventory

Sale from Doha warehouse
Delivery from Al Daayen warehouse (stock transfer first)
ERPNext tracks transfer GL + destination stock

Intercompany Transactions

Company A buys from Company B
ERPNext creates PO in A, SO in B automatically
Eliminates intercompany GL entries (consolidation)

Revenue Recognition (ASC 606)

Long-term contracts (e.g., 12-month software license)
Revenue recognized monthly (not upfront)
ERPNext creates monthly revenue GL entries automatically

Implementation at Qatar Water Company (Case Study)

Before ERPNext

  • Sales: Manual SO in Excel
  • Purchases: Emails to suppliers
  • Inventory: Weekly manual counts
  • Accounting: QuickBooks (disconnected)

Problem: Month-end discrepancy of QAR 50,000 between GL inventory and physical count

After ERPNext (12 Weeks)

  1. Day 1: Create SO (auto-stock check)
  2. Day 2: Delivery note (auto-GL entry for COGS)
  3. Day 3: Invoice (auto-revenue GL)
  4. Day 5: PO for restocking (triggered by low inventory alert)
  5. Day 10: Supplier receipt + 3-way match
  6. Day 30: Month-end close (1.5 hours vs 2 days before)

Results:

  • Inventory accuracy: 99.5% (was 85%)
  • Month-end close time: 1.5 hours (was 5 days)
  • Profitability visibility: By product, customer, region
  • Cash flow forecasting: 90-day outlook (was guesswork)

Star Tech's ERPNext Implementation

✓ End-to-end workflow design ✓ GL account mapping (Chart of Accounts optimization) ✓ Inventory valuation method setup (FIFO, weighted-average, standard cost) ✓ Sales/purchase process automation ✓ Multi-location & multi-currency configuration ✓ Compliance setup (VAT, ZAKAT) ✓ Post-go-live support (3 months included)

Get ERPNext Workflow Demo → See the full integrated process in action.

Start a Conversation

Need Expert IT Advice?

Talk to our certified engineers about your technology challenges.

  • Free IT Assessment — no commitment required
  • Tailored proposal with fixed pricing in 48 hours
  • Qatar-based certified engineers, no outsourcing
WhatsApp — Fastest Response
+974 3042 2121 · Typically replies within an hour
Call Our Office
+974 3039 0949 · Sun–Thu 8AM–6PM AST
48-Hour Proposal Guarantee

"Our clients don't just receive technology — they receive a committed partner accountable to their outcomes."

ST
Star Tech Leadership
Star Tech Middle East WLL
Get Started
base44
Edit with Base44