feat(erp): overdue invoices drive the ladder from the reconcile pass #52

Merged
sharang merged 1 commits from feat/reconcile-overdue-invoices into main 2026-09-30 11:06:30 +00:00
Owner

Fixes #50.

Live ERPNext marks invoices Overdue with a bulk update from a nightly job, which fires no webhook. From now on the 15-minute reconcile reads the open invoices itself:

  • erp.ListOverdueInvoices: submitted invoices, outstanding_amount > 0, due_date before today (Europe/Berlin)
  • the oldest invoice sets the rung: warning, then restricted after 14 days, halted after 30. The rules are shared with the webhook (overdueStep)
  • no invoice open any more and the status came from the ladder → back to active. This covers payments matched by Zahlungsabgleich, which fire no event. A status set by staff stays as it is
  • the erpmock list understands < and >

Needs read permission for Sales User on Sales Invoice (set on prod on 2026-09-30).

🤖 Generated with Claude Code

https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB

Fixes #50. Live ERPNext marks invoices Overdue with a bulk update from a nightly job, which fires no webhook. From now on the 15-minute reconcile reads the open invoices itself: - `erp.ListOverdueInvoices`: submitted invoices, `outstanding_amount > 0`, `due_date` before today (Europe/Berlin) - the oldest invoice sets the rung: warning, then restricted after 14 days, halted after 30. The rules are shared with the webhook (`overdueStep`) - no invoice open any more and the status came from the ladder → back to **active**. This covers payments matched by Zahlungsabgleich, which fire no event. A status set by staff stays as it is - the erpmock list understands `<` and `>` Needs read permission for Sales User on Sales Invoice (set on prod on 2026-09-30). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
sharang added 1 commit 2026-09-30 10:41:49 +00:00
feat(erp): overdue invoices drive the ladder from the reconcile pass
ci / shared (pull_request) Successful in 13s
ci / test (pull_request) Successful in 23m48s
ci / image (pull_request) Skipped
145b79ad22
Live ERPNext marks invoices Overdue in a nightly bulk update that fires
no document event, so the sales_invoice.overdue webhook never arrives.
Every reconcile (15 min) now lists the customer's submitted invoices with
an open amount and a due date before today (Europe/Berlin); the oldest
one sets the rung (warning, restricted after 14 days, halted after 30),
with the same rules as the webhook (shared overdueStep). When no invoice
is open any more and the status came from the ladder, the tenant goes
back to active, which covers payments matched by Zahlungsabgleich (no
event). A status set by staff is left alone.

The erpmock list understands < and > filters.

Fixes #50

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
sharang merged commit fb9a2ee621 into main 2026-09-30 11:06:30 +00:00
Sign in to join this conversation.