Catch supplier billing errors in ERPNext before you pay

By General Input

Every Monday, check last week's supplier bills against what you ordered and what actually arrived, then get a Slack digest of every overcharge.

Integrations

  • ERPNext
  • Slack Bot

Type

Agentic Task

Categories

  • Finance
  • Operations

Every Monday at 8am, audit last week's supplier bills in ERPNext for billing errors before we pay them. This is the classic finance three-way match control: the invoice against the purchase order we raised, against the purchase receipt confirming what actually arrived. Keep the whole workflow read-only against ERPNext. Submitted documents cannot be edited or deleted without cancelling them first, so report discrepancies only and never modify, cancel, or approve a posted invoice.

Start with the ERPNext List Documents action on the Purchase Invoice DocType. Filter to docstatus = 1 so only real, posted bills are audited (0 is Draft, 1 is Submitted, 2 is Cancelled), and to a posting_date inside the last 7 days. Filters are JSON arrays of [field, operator, value] triples that are AND-combined, for example [["docstatus","=",1],["posting_date",">=","2026-08-07"]]. The fields parameter defaults to just ["name"], so request the columns explicitly: name, supplier, posting_date, grand_total, and currency. Page through the results if there are more than one page of them.

For each invoice returned, call Get Document on the Purchase Invoice by name, because the line items live in a child table that only comes back on the single document read. Each item row carries links back to the originating Purchase Order and Purchase Receipt. Call Get Document again on those linked Purchase Order and Purchase Receipt documents so you can read the rate we agreed to pay and the quantity we actually received. Cache documents you have already fetched, since several invoice lines often point at the same purchase order.

Compare every billed line against those two sources and flag three things: a billed rate higher than the purchase order rate, a billed quantity greater than the quantity received, and any invoice with no purchase order linked at all, which is off-contract spend. Matching invoice lines to the right purchase order lines is judgement work: match on item code first, then fall back to description and unit of measure when codes do not line up, and say so in the report when you are unsure which line a charge belongs to. Convert quantities to a common unit of measure before comparing, so a case billed against units ordered does not read as a false discrepancy. Ignore trivial rounding differences under 1 percent so the report stays signal-heavy.

Group the findings by supplier and rank the suppliers by total money at risk, which is the summed value of the overcharges and the over-billed quantities, plus the full value of any invoice with no purchase order behind it. Within each supplier, put the largest exposure first.

Post one digest to our finance channel using the Slack Bot Send a Message action. Open with the total money at risk, the number of invoices reviewed, and the worst supplier. Then list each supplier with their offending invoices, naming the invoice id, the supplier, and the specific mismatch on each offending line: show the billed figure next to the expected figure and the difference in money, and label which of the three problems it is. Keep it scannable for a finance lead who has to act on it in a couple of minutes. If every invoice checks out, post a short all-clear note saying how many invoices were reviewed and that no discrepancies were found, rather than staying silent.

Related prompts

Explore more prompts
A brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsLinkedIn Ads budget pacing dashboard for every client accountGive your team Looker numbers without buying more seatsPause marketing emails to escalated customers, then restore them