How to Track Primary and Secondary Sales in ERPNext (2026 Distributor Guide)
ERPNext secondary sales tracking for distributors — set up warehouses, capture distributor-to-retailer data, and build primary vs secondary reports. Learn how.
If you sell through distributors, your ERP only tells half the story. Primary sales — what you ship to distributors — are easy to see. Secondary sales — what distributors actually sell to retailers — are where most brands go blind. This guide shows you exactly how to set up ERPNext for distributor secondary sales tracking, step by step.
Most FMCG and consumer-goods brands in India route stock through a distributor-to-retailer network of an estimated 12 million-plus outlets. Yet their ERP captures only the first hop. The result is predictable: overstocked distributors, dead schemes, and forecasts built on sell-in instead of real demand.
It does not have to be this way. ERPNext — the open-source ERP built on the Frappe Framework — has every primitive you need to track secondary sales properly. The catch is that nobody has written it down. The top-ranking Frappe forum thread on this exact question still has zero replies. Consider this the answer.
Quick answer
Secondary sales tracking in ERPNext means recording distributor-to-retailer sales against a per-distributor warehouse, then comparing them with primary (manufacturer-to-distributor) sales. You capture the data through a portal, a custom DocType, bulk import, or an API sync, and report on it with the Report Builder.
Primary vs secondary sales and the visibility gap
Before configuring anything, get the definitions straight, because the entire setup depends on them.
Quick answer
Primary sales are manufacturer-to-distributor transactions — the stock you invoice to your distributors (sell-in). Secondary sales are distributor-to-retailer transactions — what actually leaves the distributor godown into the market (sell-out). Primary tells you what you shipped; secondary tells you what the market consumed.
The gap between the two is where margin leaks. When you track only primary sales, a great month can simply mean you pushed stock onto distributors who cannot move it. Two months later you face returns, expired schemes, and a sales team chasing targets against phantom demand.
| Dimension | Primary sales (sell-in) | Secondary sales (sell-out) |
|---|---|---|
| Who transacts | You to distributor | Distributor to retailer or consumer |
| What it measures | Stock pushed into the channel | Real market consumption |
| ERPNext document | Sales Invoice / Delivery Note | Portal invoice, custom DocType, or import |
| Stock movement | Into the distributor warehouse | Out of the distributor warehouse |
| Why it matters | Revenue recognition, dispatch | Forecasting, scheme ROI, stock cover |
Tracking both inside one system lets you calculate the metric that actually runs a distribution business: stock cover — how many days of inventory each distributor holds based on their real sell-out rate.
Can ERPNext track secondary sales?
This is the question on the Frappe forum, and the honest answer is more useful than a flat yes.
Quick answer
Yes. ERPNext has no single secondary-sales feature, but it has every building block: a multi-level warehouse tree, Sales Invoices, Pricing Rules for schemes, Data Import, a REST API, and the Report Builder. Combine a warehouse-per-distributor structure with a capture method and ERPNext matches a dedicated DMS at zero licence cost.
The mistake most teams make is treating secondary sales as an afterthought — dumping it into the same warehouse as company stock, or tracking it in a spreadsheet bolted onto ERPNext. Both break reporting within weeks. The reliable approach is the three-step structure below: model the network, capture the data, then report on it.
The one mistake to avoid
Do not record distributor secondary sales against your own company warehouse. If you do, ERPNext cannot tell company stock apart from distributor stock, and every stock-cover and ageing report becomes meaningless. Stock location is the backbone of the whole setup.
Step 1 — Model your distribution network with a warehouse tree
ERPNext warehouses are a tree, not a flat list. That tree is what makes distributor stock visibility possible. Create one parent (group) warehouse per distributor, with child warehouses beneath it for saleable stock and returns.
Quick answer
Create a group warehouse for each distributor, for example "Distributor — Mumbai", with child warehouses under it. Primary sales move stock into the distributor warehouse; secondary sales issue stock out of it. This keeps each distributor's stock-on-hand, ageing, and days-of-cover visible in the standard Stock Balance and Stock Ledger reports.
A typical structure looks like this:
All Warehouses
├── Plant - Finished Goods
├── Depot - North
└── Distributors (group)
├── Distributor - Mumbai (group)
│ ├── Mumbai - Saleable
│ └── Mumbai - Returns
└── Distributor - Pune (group)
├── Pune - Saleable
└── Pune - Returns
When you raise a primary Sales Invoice (or Delivery Note) to a distributor, set the target warehouse to that distributor's saleable warehouse. Stock now sits against the distributor in ERPNext. Every secondary sale later draws stock out of the same warehouse, so on-hand quantity always reflects reality.
Tag distributors as customers and warehouses
Each distributor is both a Customer (for your primary invoice) and a warehouse owner (for their stock). Link the two with a custom field on the Warehouse, or name them consistently, so reports can join primary and secondary data per distributor. See the Warehouse docs for the tree setup.
This single decision — a warehouse per distributor — is what most "ERPNext cannot do secondary sales" complaints are missing.
Step 2 — Capture secondary sales data with these 5 methods
Now you record what distributors sell to retailers. The right method depends on how digitised your channel is. Here are five proven options, from fully integrated to lightweight.
1. Distributor self-service portal
Give distributors a login to the ERPNext portal or a Frappe web form to raise their own retailer invoices. Each invoice posts a real Sales Invoice against their warehouse — the cleanest, most accurate option when distributors will adopt it.
2. Custom Secondary Sales DocType
When you only receive summary sell-out data, build a lightweight custom DocType carrying retailer, item, quantity, scheme, and date — without the full accounting weight of an invoice. It still posts a Stock Entry to keep stock accurate.
3. Scheduled bulk import
Use the Data Import tool to upload distributor sales as a spreadsheet — daily or weekly — mapped to the right warehouse, item, and retailer. Zero development, ideal for a fast pilot.
4. REST API sync from Tally or a billing app
If distributors bill in Tally or a local app, push that data into ERPNext through its REST API on a schedule. No one re-keys data, and sell-out lands in near real time.
5. Van sales and POS
For direct-to-retailer or van routes, ERPNext POS and the selling module capture secondary sales at the point of billing, with offline-friendly invoicing for field teams.
Most brands start with bulk import for a quick win, then graduate the largest distributors to the portal or an API sync. Whatever the method, the rule is the same: every secondary transaction must post against the distributor's warehouse so stock and sales stay reconciled.
Not sure which capture method fits your channel?
We will map your distributor network, recommend the right mix of portal, import, and API sync, and quote a fixed implementation scope — no per-user licence trap.
Get a free setup recommendationStep 3 — Build a primary vs secondary sales report
With data flowing in, the payoff is a single report management can trust. ERPNext gives you three tools, in increasing order of power: the Report Builder, Query Reports (SQL), and Dashboard Charts with Number Cards.
Quick answer
Build a Query Report or Report Builder view that groups primary and secondary quantities by item, territory, distributor, and month. Add a Number Card and a Dashboard Chart for sell-in vs sell-out, distributor stock cover (days of inventory), and scheme liability. This gives management the channel visibility off-the-shelf reports miss.
The fields that matter most in a channel report are:
- Primary quantity and value (sell-in) per distributor and item.
- Secondary quantity and value (sell-out) for the same dimensions.
- Closing distributor stock and stock cover in days.
- Scheme cost as a percentage of secondary sales.
- Returns and damages as a percentage of primary.
Group these by month and territory, and your sales heads finally see which distributor is overstocked, which is about to run dry, and which schemes actually moved product. For non-technical users, surface the same numbers as a Dashboard so the answer is one click away every morning.
The brands that win at distribution are not the ones with the fanciest dashboard. They are the ones who can answer one question on any given morning — which distributor is sitting on dead stock, and which is about to run out. ERPNext answers that for the cost of setting it up once.
Automate schemes and claims on secondary sales
Trade schemes are where distribution margins live or die, and ERPNext automates most of it with Pricing Rules.
A Pricing Rule applies quantity-based, value-based, or free-item schemes automatically at billing — scoped by item group, customer group, or territory. So a "buy 10 get 1 free" or a 5 percent slab discount triggers without manual entry, on primary or secondary invoices.
Distributor claims for those schemes are then tracked two ways:
- As credit notes against the distributor when the claim is approved.
- As records in a custom Claim DocType, reconciled against the secondary sales that earned them.
That reconciliation — claims matched to the actual sell-out that justified them — is what turns scheme spend from a guessing game into a measured line item. For deeper India-specific accounting (GST on credit notes, TDS), see how we approach this in our guide on ERPNext vs Odoo for Indian businesses.
ERPNext vs a dedicated DMS or SFA
A fair question at this point: why not just buy a dedicated Distributor Management System (DMS) or Sales Force Automation (SFA) tool? The honest comparison:
| Capability | ERPNext (configured) | Dedicated DMS / SFA |
|---|---|---|
| Secondary sales tracking | Yes — portal, DocType, import, API | Yes — core feature |
| Distributor stock visibility | Yes — warehouse tree | Yes |
| Schemes and claims | Yes — Pricing Rules + custom DocType | Yes |
| Channel reports and dashboards | Yes — Report Builder | Yes |
| Field beat planning and GPS | Limited — needs an add-on app | Strong |
| Offline mobile order capture | Limited | Strong |
| Accounting, GST, inventory in one system | Yes — it is a full ERP | No — separate system to integrate |
| Licence model | Open source, zero per-user fee | Recurring per-user subscription |
| Data ownership | Full — self-hosted on your infra | Vendor-hosted |
Quick answer
For office-side distribution management — secondary sales, distributor stock, schemes, claims, and reporting — ERPNext can fully replace a DMS and removes per-user licence fees. Dedicated SFA tools still lead on field-force features like GPS beat tracking and offline mobile order capture. Many brands run ERPNext as the system of record and add a light field app on top.
If you already run ERPNext for accounting and inventory, extending it for secondary sales is far cheaper than buying and integrating a separate DMS. If your priority is a large field salesforce in rural beats, pair ERPNext with a focused mobile app rather than replacing it. Our Frappe and ERPNext implementation practice does exactly this kind of fit assessment.
Your rollout plan for secondary sales tracking
You do not need a six-month project. A focused rollout gets you to live reporting quickly.
Week 1 — Model the network
Build the distributor warehouse tree, tag distributors as customers, and confirm primary invoices move stock into the right warehouse.
Week 2 — Turn on capture
Start with bulk import for all distributors, then pilot the portal or an API sync with one or two of your largest partners.
Week 3 — Wire up schemes
Configure Pricing Rules for your live schemes and set up the claim record so scheme cost ties back to secondary sales.
Week 4 — Ship the report
Publish the primary vs secondary report and a one-screen dashboard for sales heads, then iterate on the metrics they ask for.
Because ERPNext is open source on Frappe, every customisation you build — the custom DocType, the API sync, the reports — stays yours, regardless of who hosts it or who supports it later.
The brands that get this right stop arguing about whose numbers are correct and start acting on a single source of truth. That is the whole point of tracking secondary sales in ERPNext: not more data, but the right data, in time to act on it.
Frequently asked questions
Written by
Manoj
Founder of Mith Tech, an open-source ERP & automation studio. Hands-on ERPNext/Frappe implementation across multi-branch, multi-warehouse Indian operations — GST/TDS/PT compliance, branch-level permissions, and custom Frappe apps that give management real-time visibility.
Keep reading
Get real-time secondary sales visibility in ERPNext
Book a free distribution & secondary-sales consultation. We deploy ERPNext on infrastructure you own — no per-user licence fees.
Manoj
Comments
No comments yet. Start a new discussion