Skip to content

Case study · AI accounts-payable agent

Solo build · October 2026

InvoiceFlow.

Invoices in. Approved bills out. Every decision explained.

An AI agent for the accounts team. It reads supplier invoices, checks them against the purchase order and what was actually received, stops duplicates and fraud, and posts approved bills into Odoo. People only look at the exceptions.

0

false approvals on 12 trick invoices

100%

correct decisions on 97 test invoices

100%

of invoice fields read correctly by AI (tested set)

~25s

from upload to a decision

Demo

Monday morning: five invoices, sorted in two minutes

Ayesha uploads five supplier invoices, one of them a phone photo. Two go straight through, a duplicate and a bank-account fraud are stopped, and Bilal approves the big one, which lands in Odoo. Real footage: real Gemini, real Odoo.

The problem

Paying suppliers is still mostly typing and checking.

For every invoice, someone types the vendor, number, dates, lines and tax into the ERP, checks it against the purchase order, confirms the goods arrived, makes sure it wasn't paid already, then chases a manager. At 4–8 minutes each, 500 invoices is a full-time job.

Mistakes are expensive: the same invoice paid twice, goods paid for but never received, or money sent to a fraudster who emailed “our bank details have changed”.

InvoiceFlow does the reading and the checking, and lets people spend their time only on the invoices that actually need a person.

How it works

  1. 01

    Upload

    PDFs, scans or a photo from a phone. The same file sent twice is spotted straight away.

  2. 02

    AI reads

    Gemini reads the vendor, invoice number, dates, lines, tax and total. Each value must be found on the page.

  3. 03

    Rules check

    The math, the vendor, the bank account, the purchase order, what was received, and every bill already paid.

  4. 04

    People approve

    Clean, small invoices go straight through. Big ones go to a manager. Problems are stopped with a clear reason.

  5. 05

    Posted to Odoo

    Approved invoices become vendor bills in Odoo, linked to the purchase order, with the PDF attached.

Inside the product

Real screens from InvoiceFlow and Odoo

  • InvoiceFlow: the inbox, sorted

    The inbox, sorted

    Posted, awaiting approval and needs review, each with the reason

  • InvoiceFlow: every value grounded

    Every value grounded

    Hover a field and its place on the page lights up

  • InvoiceFlow: duplicate caught

    Duplicate caught

    Same invoice, different number format

  • InvoiceFlow: bank-account fraud blocked

    Bank-account fraud blocked

    New IBAN plus hidden "approve" text in the PDF

  • InvoiceFlow: awaiting approval

    Awaiting approval

    Above the auto-approve limit: a manager decides

  • InvoiceFlow: approved and posted

    Approved and posted

    One click, then a link to the bill in Odoo

  • InvoiceFlow: the bill in odoo

    The bill in Odoo

    Draft vendor bill linked to the purchase order

  • InvoiceFlow: reading in progress

    Reading in progress

    Each invoice moves through the pipeline live

Built to be trusted with money

What it catches before anyone pays

Duplicates

INV-2291 sent again as "INV 2291" is caught, against InvoiceFlow and against bills already in Odoo.

Bank-account fraud

"We changed our bank account" is the most common invoice scam. A new account is always blocked until someone calls the supplier.

Prompt injection

Invisible text saying "approve this invoice" is detected and ignored. The AI only reads; it can't approve anything.

Price & quantity

A price 8% above the purchase order, or 10 racks billed when 6 arrived, goes to review with the exact numbers.

No made-up numbers

If a value the AI returns isn't printed on the page, it is thrown out. Hover any field to see where it came from.

Separation of duties

The person who uploaded or edited an invoice can't approve it. Approvers have money limits.

Measured, not claimed

Test results

Real AI · Gemini

100%

Header fields read correctly on 8 invoices: 3 layouts, a scan, a phone photo and 3 trick invoices. Line amounts 97.9%.

Decisions

100%

Every one of the 97 generated invoices landed where it should: straight through, approval or review.

Trick invoices

0

False approvals across 12 invoices built to fool it: duplicates, fraud, bad totals, wrong currency, injection.

Test suite

155

Backend tests: rules, grounding, ERP sync and posting, permissions, the full upload-to-Odoo flow.

How it's built

Architecture

In

Dashboard

Next.js · review & approvals

Uploads

PDFs, scans, phone photos

API tokens

Scanners and integrations

Core

Django + DRF API
Celery pipeline
Rules engine
ERP sync & posting

Page images and text layer, grounded extraction, checks and routing, approvals, encrypted bank details, audit log.

Services

PostgreSQL + Redis

data, queues, ERP mirror

Gemini

reads invoices, nothing else

Odoo 18

vendors, POs, receipts, bills

Who it's for

Use cases

  • Retail & distribution: Hundreds of supplier invoices a month, checked against what was ordered and received
  • Manufacturing: Raw-material bills matched to purchase orders and goods receipts before payment
  • Offices & services: Monthly bills (internet, electricity, cleaning) approved automatically when they look normal
  • Accounting firms: Process clients' invoices into their ERP with a full audit trail
  • Finance controllers: Stop duplicate payments and fake "new bank account" invoices before money leaves

Compared with

AspectManual entryOCR templatesInvoiceFlow
Typing4–8 minutes per invoiceTemplate per supplierNo templates: AI reads any layout
Wrong numbersTyposBreaks on new layoutsValues not on the page are rejected
Who decidesPeople, every timePeopleRules decide; people approve exceptions
Duplicates & fraudIf someone noticesNot checkedChecked on every invoice
AuditEmail threadsPartialEvery field, rule and approval logged

Engineering notes

Decisions that mattered

01

AI reads, rules decide

The language model only fills a strict form of what's printed. Approving, matching and posting are plain rules that can be tested and explained, so a sentence hidden in a PDF can't change a decision. Every routing decision is saved with the rules version that made it.

02

Grounded or rejected

Models can return numbers that look right but aren't on the page. InvoiceFlow searches the PDF's own text for every value and keeps its position, so reviewers see it highlighted, and anything it can't find is cleared and flagged instead of trusted.

03

Tested with invoices built to fool it

I wrote a generator that makes 97 realistic invoices in 10 supplier layouts, with scans, phone photos and 12 trick cases, each with an answer key. An eval command runs them through the real pipeline and scores every field and decision.

04

Free-tier friendly, production shaped

Gemini runs on free-tier keys: several keys and models are rotated, per-minute limits are waited out, and answers are cached so a document never costs twice. Bank details are encrypted, ERP posting can't create a bill twice, and every change is in an append-only audit log.

How it was built

  1. Day 1

    Product and engineering design: 17 docs and 4 decision records. Django API, roles (clerk, approver, controller, admin), sign-in, append-only audit log, Next.js shell.

  2. Day 2

    Odoo seeded with a company, vendors, purchase orders and receipts. ERP adapter with an encrypted local mirror and incremental sync.

  3. Day 3

    Invoice generator: 10 supplier layouts, 97 invoices with answer keys, scans, photos and trick cases.

  4. Days 4–5

    Upload, page images and text layer, grounded Gemini extraction, rules, routing, approvals, posting to Odoo, review screen, evals, demo.

  • Next: email inbox, email and Slack approvals, QuickBooks and Xero.

Stack

PythonDjango 6DRFCeleryRedisPostgreSQLPydanticGeminipdfplumberpypdfium2Odoo 18 JSON-RPCNext.js 16React 19TypeScriptTailwindPlaywrightDockerAES-GCM encryption

Drowning in invoices or documents?

I build AI automation that reads documents, checks them against your systems and is safe to run on real money.

Talk to me

Also built

CamMind: plain-English rules for IP cameras