Perpetual Inventory
In the perpetual inventory system, an accounting entry is made for every stock transaction.
In a periodic inventory system, stock is accounted for at longer intervals, for example monthly or quarterly. In the perpetual system, the value of stock in your books is always up to date: on receipt of items in a Warehouse, the balance in the stock (inventory) account increases, and when items are delivered from the Warehouse, an expense is booked and the balance in the stock account reduces.
Note: In a new ERPNext site, Perpetual Inventory is enabled by default.
1. Activate Perpetual Inventory
Perpetual Inventory is enabled per Company. Go to:
Accounting > Company > Stock and Manufacturing tab > Enable Perpetual Inventory

Note that if you disable Perpetual Inventory, you will have to create accounting entries manually to update the actual stock balance in the stock accounts. See Periodic Inventory.
Set up the following default accounts for each Company, if not already set. These accounts are created automatically in a new ERPNext site.
In the Stock and Manufacturing tab:
- Default Inventory Account (Asset): The stock account used for Warehouses that don't have an account of their own.
- Stock Adjustment Account (Expense): Used for stock adjustments, such as Material Issue and Stock Reconciliation differences.
- Stock Received But Not Billed (Liability): A temporary account credited when items are received before the Purchase Invoice is made.
- Default Purchase Price Variance Account and Default Manufacturing Variance Account (Expense): Used for items valued at Standard Cost.
In the Accounts tab:
- Default Cost of Goods Sold Account (Expense): Debited with the value of stock delivered to customers.
Other options in the Stock and Manufacturing tab:
- Enable Item-wise Inventory Account: If enabled, the system will use the inventory account set in the Item, Item Group or Brand. Otherwise, it will use the inventory account set in the Warehouse.
- Enable Stock Delivered But Not Billed: If enabled, the value of goods delivered before invoicing is recorded in the Stock Delivered But Not Billed account.
1.1 Warehouse Accounts
If you want a separate account for each Warehouse, create an account of type 'Stock' for it in the Chart of Accounts, under:
Application of Funds (Assets) > Current Assets > Stock Assets
Then open the Warehouse and set this account in its Account field. This helps in filtering and viewing statements Warehouse-wise.
For stock transactions, general ledger entries are made against the account set in the Warehouse. If no account is set for the Warehouse, the system takes the account of the parent Warehouse. If no account is set for the parent Warehouse either, the Default Inventory Account of the Company is used.
2. Example
In the following example, the company Nova Electronics Trading uses the Default Inventory Account 'Stock In Hand - NET' for all its Warehouses. The item 'NET-SPR-PCB-BOARD' (Replacement Circuit Board) uses the FIFO valuation method.
2.1 Purchase Receipt
Suppose you purchase 10 Nos of the item at $200 each from the supplier 'Apex Devices'. The details of the Purchase Receipt are:
Items:
| Item | Warehouse | Qty | Rate | Amount | Valuation Amount |
|---|---|---|---|---|---|
| NET-SPR-PCB-BOARD | Stores - NET | 10 | 200 | 2,000 | 2,100 |
Taxes and Charges:
| Account | Amount | Consider Tax or Charge for |
|---|---|---|
| Freight and Forwarding Charges - NET | 100 | Valuation and Total |
| ST 6% - NET | 120 | Total |
The shipping charges are included in the valuation of the item, so the valuation rate is (2,000 + 100) / 10 = 210.
Stock Ledger:

General Ledger:

As the stock balance increases through the Purchase Receipt, the stock account 'Stock In Hand - NET' is debited with the valuation amount, and the temporary account 'Stock Received But Not Billed' is credited with the item amount, to maintain the double-entry accounting system. At the same time, the charge with the category 'Valuation' or 'Valuation and Total' (here, the freight) is credited to its account head, to avoid booking the expense twice. Taxes with the category 'Total' are not posted by the Purchase Receipt.
2.2 Purchase Invoice
On receiving the bill from the supplier for the above Purchase Receipt, you make a Purchase Invoice against it. The general ledger entries are:

Here, the 'Stock Received But Not Billed' account is debited, which nullifies the effect of the Purchase Receipt. The freight and tax are debited to their accounts, and the supplier ('Creditors') is credited with the invoice total.
2.3 Delivery Note
Let's say you have an order from the customer 'Bluewave Systems' to deliver 5 Nos of the item at $300 each. The details of the Delivery Note are:
| Item | Warehouse | Qty | Rate | Amount |
|---|---|---|---|---|
| NET-SPR-PCB-BOARD | Stores - NET | 5 | 300 | 1,500 |
General Ledger:

As the items are delivered from the 'Stores - NET' Warehouse, the stock account is credited and an equal amount is debited to the expense account 'Cost of Goods Sold'. The amount is the valuation amount (buying cost) of the items sold, calculated using the item's valuation method (FIFO / Moving Average), or the actual cost of serialized items.
Tip: Valuation Rate = Purchase Rate + Charges Included in Valuation = 200 + (100 / 10) = 210
Total Valuation Amount = 210 × 5 = 1,050
The selling amount and the taxes are posted when you make the Sales Invoice.
2.4 Sales Invoice with Update Stock
If you don't make a Delivery Note against the order, and instead make a Sales Invoice directly with Update Stock ticked, the same stock and Cost of Goods Sold entries are posted by the Sales Invoice, along with the normal accounting entries of the invoice.
2.5 Stock Entry (Material Transfer)
Transfer of 2 Nos from 'Stores - NET' to 'Work In Progress - NET':

The stock moves from one Warehouse to the other at the same valuation rate. Since both Warehouses use the same account ('Stock In Hand - NET'), no general ledger entry is posted. If the Warehouses had different accounts, the account of the target Warehouse would be debited and the account of the source Warehouse credited.
2.6 Stock Entry (Material Issue)
Issue of 1 No from 'Work In Progress - NET':

The stock account is credited and the 'Stock Adjustment' account (or the expense account set in the Stock Entry row) is debited with the valuation amount.
2.7 Stock Entry (Material Receipt)
For a Material Receipt, the stock account is debited and the 'Stock Adjustment' account (or the expense account set in the Stock Entry row) is credited with the value of the received stock.
Tip: In any submitted stock transaction, click on View > Stock Ledger or View > Accounting Ledger to see its stock ledger and general ledger entries.