Technical

AI in the Month-End Close: Accruals, Variances and Controls

Where an AI agent helps the month-end close in Odoo or ERPNext: suggesting accruals, drafting variance explanations, chasing missing documents and tracking the checklist. A named person still approves every number.

Kalvyai Engineering · · 8 min read

AI in the Month-End Close: Accruals, Variances and Controls (cover)
On this page

Where the close time actually goes

Most month-end closes are not slow because posting journal entries is hard. They are slow because of waiting and checking. People wait for a vendor bill that hasn't arrived. They check whether last month's accrual was reversed. They ask a department head why travel spend doubled. They work out which checklist items are actually done and which were ticked out of habit.

An AI agent can help with that part. It can read the ledger, compare periods, draft entries and messages, and keep the checklist honest. It should not decide what the numbers are. A named person still approves every entry and signs off the close.

This post covers four areas where AI earns its place in the close, and the controls we put around each one. The examples use Odoo and ERPNext, but the pattern works in any ERP.

The ground rule: the agent proposes, a person posts

Every use case below depends on one design rule:

  • The agent has read access to the ledger and supporting documents.
  • It can create drafts or proposals. It never creates posted entries.
  • Every proposal includes its reasoning and links to the source records.
  • A person with posting rights reviews the proposal, edits it if needed, and posts it.
  • Every action, by the agent or the reviewer, goes into an audit log.

If your setup lets the agent post into a period you are closing, fix that before you build anything else.

1. Accrual suggestions

Accruals suit AI well because the evidence usually already exists in the system. Someone just has to go and find it.

Where the agent looks

  • Received but not billed: purchase order lines where the received quantity is higher than the billed quantity.
  • Recurring vendors with no bill this period: rent, utilities, software subscriptions and retainers that were billed in each of the last few months but not this one.
  • Contracts with a known monthly amount: leases, maintenance agreements, service contracts.
  • Prior-period accruals: entries that should have reversed but didn't, or reversed into the wrong date.

Example query: received but not billed (Odoo)

In Odoo, purchase order lines carry received and invoiced quantities, so the first pass is plain SQL:

SQL
SELECT po.name AS po_number,
       rp.name AS vendor,
       pol.name AS line_description,
       pol.qty_received,
       pol.qty_invoiced,
       (pol.qty_received - pol.qty_invoiced) * pol.price_unit AS unbilled_value
FROM purchase_order_line pol
JOIN purchase_order po ON po.id = pol.order_id
JOIN res_partner rp ON rp.id = po.partner_id
WHERE po.state IN ('purchase', 'done')
  AND pol.qty_received > pol.qty_invoiced
ORDER BY unbilled_value DESC;

This ignores currency, taxes and price changes after the order, so treat it as a candidate list, not a number to post. In ERPNext, the usual starting point is Purchase Receipts that are not fully billed.

The query finds candidates. The AI adds judgment on top. It estimates amounts for recurring vendors from their billing history. It flags when a bill may already exist under a different PO. It suggests the expense account based on past bills from the same vendor. It also writes the narration.

What a proposal should look like

The reviewer needs to see the evidence and how confident the agent is, not just a figure:

JSON
{
  "type": "accrual_proposal",
  "period": "2025-03",
  "vendor": "Acme Facilities",
  "amount": 4200.00,
  "currency": "USD",
  "debit_account": "Building Maintenance",
  "credit_account": "Accrued Expenses",
  "reversal_date": "2025-04-01",
  "basis": "history_estimate",
  "evidence": [
    "Vendor bills for Dec, Jan, Feb at 4,200.00 each",
    "No bill or draft bill dated March found",
    "Contract ref MC-2023-014 attached to vendor"
  ],
  "confidence": "medium",
  "status": "awaiting_review"
}

The basis field matters. An accrual backed by a goods receipt is a different thing from one estimated from three months of history, and the reviewer should be able to see that at a glance.

Controls for accruals

  • Proposals are created as drafts in the period being closed, or as records outside the ledger altogether.
  • The reversal date is set explicitly, and the reviewer confirms it.
  • You choose a materiality threshold. Below it, a reviewer can approve a batch at once. Above it, each item gets its own review.
  • The agent never edits or cancels a posted entry.

2. Variance explanations

Variance commentary takes a lot of time, and readers often find it vague. Split the work in two:

  • The maths is deterministic. Your code computes the variances and decides which ones need an explanation.
  • The narrative is drafted by AI. The model gets the figures and the journal lines behind them, and writes the explanation.

The model should never calculate the variance itself. Give it the numbers.

Python
def variances_to_explain(actuals, comparison, abs_threshold, pct_threshold):
    """Return accounts whose movement needs a written explanation."""
    flagged = []
    for account, actual in actuals.items():
        base = comparison.get(account, 0.0)
        diff = actual - base
        pct = (diff / base * 100) if base else None
        if abs(diff) >= abs_threshold or (pct is not None and abs(pct) >= pct_threshold):
            flagged.append({
                "account": account,
                "actual": round(actual, 2),
                "comparison": round(base, 2),
                "difference": round(diff, 2),
                "pct": round(pct, 1) if pct is not None else None,
            })
    return sorted(flagged, key=lambda v: abs(v["difference"]), reverse=True)

For each flagged account, pass the model the largest journal lines that make up the difference. Then set two rules in the instructions:

  1. Every statement must cite a journal entry, document or vendor. No general explanations like "seasonal increase" without a source.
  2. If the lines don't explain the movement, the model says "unexplained" and drafts a question for the account owner. It must not guess.

A good draft reads like this: "Travel up 38% vs February (+6,150). Two entries make up 5,400 of the increase: flights for the Dubai trade show (JE/2025/03/0112) and hotel for the same trip (BILL/2025/03/0087). Remaining 750 unexplained; question sent to the Sales Ops owner."

Controls for variances

  • Run an automatic check that every number in the draft matches a figure from the input. If one doesn't match, reject the draft.
  • A person edits and approves the commentary before it reaches management.
  • Unexplained items stay open on the checklist until someone answers them.

3. Missing-document chasing

This is the most tedious part of the close, and agents are good at it because the work is repetitive and easy to check.

What the agent finds

  • Vendor bills posted without an attached document
  • Expense lines without receipts
  • Bank lines with no matching entry
  • Journal entries above a threshold with no supporting attachment
  • Accruals from last month where the real bill never arrived

What the agent does with them

  1. Groups the missing items by owner: an employee, a department head or a vendor.
  2. Drafts one message per owner that lists the specific items, with dates and amounts.
  3. Sends the message after approval, or automatically if it uses a template you have pre-approved.
  4. Tracks replies and attachments, and marks items resolved when the document arrives.
  5. Escalates anything still open by a date you set.

When bills arrive as PDFs or photos, they still have to get into the ERP. Our AI Invoice, Bill & PO OCR app scans vendor bills, customer orders and invoices into verified Odoo drafts, so a chased document becomes a reviewable draft instead of another manual entry. For unmatched bank lines, AI Bank Reconciliation imports CSV or Excel bank statements into Odoo and auto-matches transactions, which shortens the list of lines that need chasing in the first place.

Controls for chasing

  • Keep an allow-list of who the agent may contact, and through which channels.
  • Messages include only the items that person needs to act on. No account balances, no other people's data.
  • Messages to external vendors go out only from approved templates, or after a person approves them.
  • Set a rate limit so nobody receives five reminders in a day.

4. Checklist tracking

Most close checklists are spreadsheets where people tick boxes. The weakness is that a tick is a claim, not evidence. An agent can check the system itself.

Define each task with a check the agent can run:

YAML
close_period: 2025-03
tasks:
  - id: bank_rec_main
    title: Main bank account reconciled
    owner: ap_lead
    evidence_check: unreconciled_bank_lines(account="Main Bank", up_to="2025-03-31") == 0
    due: workday_2
  - id: accruals_posted
    title: March accruals reviewed and posted
    owner: controller
    evidence_check: open_accrual_proposals(period="2025-03") == 0
    due: workday_3
  - id: ap_documents
    title: All March vendor bills have attachments
    owner: ap_lead
    evidence_check: bills_without_attachment(period="2025-03") == 0
    due: workday_3
  - id: variance_review
    title: Variance commentary approved
    owner: finance_manager
    evidence_check: unapproved_variance_notes(period="2025-03") == 0
    due: workday_4

The check functions are yours to write against your ERP. The agent runs them on a schedule and posts a short daily status: done, blocked (and by what), and at risk of missing its due date.

The agent can mark a task as "evidence found". Only the owner can mark it "signed off". Keep those two states separate.

The controls that keep a person responsible

The controls under each use case come from a few principles you can apply across the whole close.

Permissions

Give the agent its own user with read access to accounting, write access only to draft records, and no posting rights. Don't let it run under an administrator account. If you need finer control over which menus, fields and actions that user can reach in Odoo, Access Management Pro lets you hide menus, buttons and fields and set read-only users.

Period locks

Once a period is signed off, lock it in the ERP so that nothing, including the agent, can change it. Odoo has lock dates in the Accounting app. ERPNext has an accounts frozen-till date in Accounts Settings.

Approvals with thresholds

Decide in advance which proposals can be approved as a batch and which need individual review. Write the thresholds down. Don't leave them inside a prompt.

Budgets

A close run that loops over thousands of lines can burn through model usage quickly. Put a hard limit on spend. AI Base for Odoo and AI Base for ERPNext let you plug in any AI model with a hard monthly cap.

Audit trail

For every proposal and message, log:

  • what the agent saw (record IDs, not copies of the data)
  • what it proposed or sent
  • who approved, edited or rejected it, and when
  • what was finally posted

With this log, an auditor's question like "who decided this accrual?" has a one-line answer: a named person, on a date, based on listed evidence.

Review the reviewers

Track how often proposals are accepted unchanged. A very high acceptance rate can mean the agent is accurate, or it can mean people have stopped reading. Sample a few approved items each month and check them properly.

What we would not automate

  • Judgment calls on provisions, write-offs and revenue recognition
  • Posting to the general ledger
  • Final sign-off of the close
  • Anything sent to auditors or tax authorities without review

The agent can prepare all of these. A person decides them.

A rollout that works

  1. Map your current close. List every task, its owner, and where the time goes. Pick the two tasks that cause the most waiting.
  2. Start read-only. Run the agent for one close and have it produce proposals and drafts outside the ERP. Compare them with what your team actually did.
  3. Add drafts in the ERP. Once the proposals are useful, let the agent create draft records, with permissions and budget caps in place.
  4. Turn on chasing with templates. Start with internal staff, then add vendors once the templates are agreed.
  5. Move the checklist to evidence checks. Replace ticks with checks one task at a time.
  6. Review after each close. Look at acceptance rates, unexplained variances and late items, and adjust the thresholds.

How Kalvyai can help

We build and connect Odoo, ERPNext and Shopify systems, and we build AI agents that work inside them with human approvals, budgets and an audit trail. For the month-end close, that means accrual proposals, variance drafts, document chasing and checklist checks wired into your own ERP data, with posting rights left with your team. You can browse our ready-made apps at store.kalvyai.com. If you want to talk through your close process, get in touch.

Share this article

  • month-end close
  • AI agents
  • accounting
  • Odoo
  • ERPNext
  • internal controls
  • audit trail

Kalvyai Engineering · Engineering team

The engineers who build, connect and fix business systems at Kalvyai: Odoo, ERPNext, Shopify and AI agents that work inside them with approvals, budgets and an audit trail.

Comments

No comments yet. Questions and corrections are welcome.

Rate this post or leave a comment

Your rating (optional)
Not rated

Comments appear after an editor approves them. See our privacy notice.

Read next

AI Bank Reconciliation: Suggested Matches a Person Confirms (cover)Technical
Kalvyai EngineeringAI agents

AI Bank Reconciliation: Suggested Matches a Person Confirms

How an AI matcher suggests bank reconciliation matches from descriptions and amounts, explains each one, sorts them by confidence, and leaves the final confirmation to a person.

7 min read

Claude Tool Use for ERP Tasks: Safe Read and Write Actions (cover)Technical
Kalvyai EngineeringAI agents

Claude Tool Use for ERP Tasks: Safe Read and Write Actions

How to give Claude function calling access to your ERP without giving it the keys: narrow tools, argument validation in code, approval gates for writes, and a log entry for every call. Includes a Python example against Odoo.

6 min read

Newsletter

Get new guides in your inbox.

Practical notes on Odoo, ERPNext, Shopify and AI agents, written by the engineers who build them. No spam, and you can ask to stop at any time.

Prefer a feed? Subscribe by RSS. We use your email only to send new articles. See our privacy policy.