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 sell to retailers, are where most brands lose sight. This guide shows how to set up ERPNext to track distributor secondary sales, step by step.
Quick answer
Secondary sales tracking in ERPNext means recording distributor-to-retailer sales against each distributor's stock, then comparing them with primary (manufacturer-to-distributor) sales. You capture the data through a portal, a custom record, bulk import or an API sync, keep the distributor's stock apart from your own books, and report on it with the Report Builder.
Most FMCG and consumer-goods brands in India sell through distributors into a very large number of retail outlets, yet their ERP sees only the first hop. The result is predictable: overstocked distributors, schemes that don't move product, and forecasts built on sell-in instead of real demand. Our page for brands that sell this way is distribution ERP for wholesale and trading.
ERPNext, the open-source ERP built on the Frappe Framework, has the pieces you need to track secondary sales. They just aren't assembled into one feature, and the Frappe forum thread on this exact question has little to go on. This guide is our answer.
What is the gap between primary and secondary sales?
Get the definitions straight first, because the whole 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 leaves the distributor's godown into the market (sell-out). Primary tells you what you shipped; secondary tells you what the market bought.
The gap between the two is where margin leaks. When you track only primary sales, a great month can mean you pushed stock onto distributors who can't move it. A couple of months later you face returns, expired schemes, and a sales team chasing targets against demand that isn't there.
| 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 |
Primary vs secondary sales in an ERPNext distribution setup
Tracking both in one system lets you calculate the number that runs a distribution business: stock cover, how many days of stock each distributor holds at their real sell-out rate.
Can ERPNext track secondary sales?
Yes, with a little design. The honest answer is more useful than a flat yes.
Quick answer
Yes. ERPNext has no single secondary-sales feature, but it has the building blocks: warehouse trees, Sales Invoices, Pricing Rules for schemes, Data Import, a REST API, a portal and the Report Builder. Combine a distributor stock structure with a capture method and ERPNext covers office-side channel tracking with no licence fee.
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 beside ERPNext. Both break reporting within weeks. The reliable approach is the three steps below: model the network, capture the data, then report on it.
Step 1: how do you model your distribution network?
ERPNext warehouses form a tree, and that tree is what makes distributor stock visible. The question is where the tree lives, so that distributor stock never sits in your own accounts.
Quick answer
Keep a stock structure per distributor that is separate from your own books. Two ways work: a separate ERPNext company used only for channel tracking, with a group warehouse per distributor; or a custom record holding each distributor's stock and sell-out by item. Primary sales stay normal sales in your company; the same quantities are added to the distributor's stock, and secondary sales take them out.
With a separate channel-tracking company, a typical tree looks like this:
Channel Stock (separate company, tracking only)
└── 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 in your own company, the same quantity is posted into that distributor's saleable warehouse in the tracking company, by an import or a small automation. Every secondary sale then draws stock out of it, so the distributor's on-hand quantity follows reality while your own books stay correct. Agree the setup with your accountant, so the tracking company's stock is never read as yours.
This one decision, a stock structure per distributor kept apart from your own, is what most "ERPNext can't do secondary sales" complaints are missing.
Step 2: how do you capture secondary sales data?
Now you record what distributors sell to retailers. The right method depends on how digital your channel is. Here are five options, from fully integrated to light.
1. Distributor self-service portal
Give distributors a login to the ERPNext portal or a Frappe web form to record their own retailer sales against their stock. The cleanest, most accurate option when distributors will use it. The A dealer orders on their own demo shows the portal side.
2. Custom Secondary Sales record
When you only receive summary sell-out data, build a light custom DocType carrying retailer, item, quantity, scheme and date, without the full accounting weight of an invoice. It can post a stock movement in the tracking structure to keep distributor stock right.
3. Scheduled bulk import
Use the Data Import tool to upload distributor sales from a spreadsheet, daily or weekly, mapped to the right distributor, item and retailer. No development, so it suits a quick 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. Nobody re-keys data, and sell-out arrives close to when it happens.
5. Van sales and POS
For direct-to-retailer or van routes, ERPNext POS and the selling module record secondary sales at billing. ERPNext POS needs a connection to the server; for vans that must bill without signal, use an offline-first POS or order app that syncs to ERPNext when the connection returns (see does ERPNext work offline?).
Many brands start with bulk import for a quick win, then move the largest distributors to the portal or an API sync. Whatever the method, the rule is the same: every secondary transaction posts against that distributor's stock, so stock and sales stay reconciled.
Step 3: how do you build a primary vs secondary sales report?
With data flowing in, the payoff is one 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 against sell-out, distributor stock cover (days of stock) and scheme liability. That gives management the channel view that standard reports miss.
The fields that matter most in a channel report:
- 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 see which distributor is overstocked, which is about to run dry, and which schemes moved product. For non-technical users, put the same numbers on 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.
A worked example: distributor stock cover in days
The most useful number this setup unlocks is stock cover: how many days of stock a distributor holds at their real sell-out rate. It tells you who is about to run dry and who is quietly sitting on dead stock. Here is the calculation, with numbers.
Quick answer
Distributor stock cover (in days) = closing stock ÷ average daily secondary sales. Take the distributor's on-hand quantity, divide by the average units they sell to retailers per day over the last 30 days, and you get days of cover. Set the low and high limits from your own replenishment lead time and the product's shelf life.
Say you pull the last 30 days for one SKU across two distributors from their stock balances and secondary sales:
| Distributor | Closing stock (units) | Secondary sales, 30 days | Avg/day | Stock cover |
|---|---|---|---|---|
| Mumbai | 1,800 | 3,000 | 100 | 18 days |
| Pune | 2,400 | 600 | 20 | 120 days |
Both distributors look similar on primary sales: you shipped each a healthy quantity last quarter. Secondary sales tell the real story. Mumbai turns its stock in 18 days and will need a replenishment order within the fortnight; Pune is sitting on four months of cover and is a candidate for a return, an expiring scheme or a transfer to a neighbouring territory. Without secondary data, both show as "sold" and you would ship Pune more.
In ERPNext this is a Query Report: closing stock comes from the Stock Balance report for each distributor's warehouse in the tracking structure, and average daily sell-out from secondary sales grouped by item and distributor. Colour the stock-cover column against your limits, and your sales heads can triage the whole channel at a glance every morning.
How do you automate schemes and claims on secondary sales?
Trade schemes are where distribution margins are won or lost, and ERPNext automates most of the work with Pricing Rules.
A Pricing Rule applies quantity, value or free-item schemes at billing, scoped by item group, customer group or territory. So a "buy 10 get 1 free" or a 5 percent slab discount applies without manual entry on your primary invoices, and on secondary sales recorded as invoices.
Distributor claims for those schemes are then tracked in one of 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 sell-out that justified them, turns scheme spend from a guess into a measured line. How GST applies to scheme credit notes, and whether TDS applies to a claim, are questions for your CA.
Should you use ERPNext or a dedicated DMS/SFA?
A fair question at this point: why not buy a dedicated Distributor Management System (DMS) or Sales Force Automation (SFA) tool? The honest comparison:
9 rows · click a column to sort
| 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 |
ERPNext configured for distribution vs a dedicated DMS or SFA
Quick answer
For office-side distribution management (secondary sales, distributor stock, schemes, claims and reporting) ERPNext can replace a DMS and removes per-user licence fees. Dedicated SFA tools are still stronger on field 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.
If you already run ERPNext for accounting and stock, extending it for secondary sales usually costs less than buying and integrating a separate DMS. If your priority is a large field sales force on rural beats, pair ERPNext with a focused mobile app rather than replacing it. Our ERPNext implementation work starts with exactly this kind of fit check.
What should your rollout plan look like?
A focused rollout gets you to live reporting without a long project. How long each stage takes depends on how many distributors you have and how clean their data is.
Stage 1: model the network
Build the distributor stock structure apart from your own books, link distributors to their customer records, and confirm each primary invoice adds the quantity to the right distributor's stock.
Stage 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 distributors.
Stage 3: wire up schemes
Set up Pricing Rules for your live schemes and the claim record, so scheme cost ties back to secondary sales.
Stage 4: ship the report
Publish the primary vs secondary report and a one-screen dashboard for sales heads, then add the measures they ask for.
Because ERPNext is open source on Frappe, everything you build (the custom record, the API sync, the reports) stays yours, whoever hosts or supports it later.
The brands that get this right stop arguing about whose numbers are correct and start acting on one set. That is the point of tracking secondary sales in ERPNext: not more data, but the right data, in time to act on it. The distribution page shows the ordering and stock flows running live on a demo company.
Comments & ratings
No comments yet. Start a new discussion.
Manoj · Published on 6 June 2026
Worked with us? Leave a Google review