On the live ERPNext (v15), the sales_invoice.overdue webhook never fires. ERPNext marks invoices Overdue in the daily scheduler job erpnext.controllers.accounts_controller.update_invoice_status, which runs a bulk UPDATE ... SET status='Overdue' through the query builder. That write skips document events (on_update_after_submit), so the Frappe Webhook breakpilot-sales_invoice.overdue is never triggered.
As a result, on production the ladder path active → warning → restricted (14 d) → halted (30 d) for unpaid invoices does not happen. A customer who never pays stays active. On staging only the erpmock fired this event, so gate 04 did not catch it.
Found on 2026-09-30 during the SEPA trial run on prod (bp-smoketest).
Fix
Run it from Reconcile (every 15 min), which already walks every tenant that has an ErpCustomerID:
days_overdue = today (Europe/Berlin) − the oldest due_date;
apply the same rungs as the webhook handler (restrictAfterDays / haltAfterDays, never move backwards, ignore demo/halted/archived). Share the code with the EventInvoiceOverdue case;
write the audit entry with source reconcile:invoice_overdue:<invoice>.
Return to active is already handled by payment_entry.submit, and that event does fire. As a safety net, reconcile should also move warning/restricted back to active when no overdue invoice is left, e.g. after a payment reconciliation (Zahlungsabgleich), which fires no event.
Keep the webhook: it's harmless, and it would help if a later ERPNext version fires events on that update.
ERPNext permission (manual)
The API user platform-registry@breakpilot.com has the roles Sales User and Stock User. Neither Sales Invoice nor Subscription has a Sales User permission row, so reconcile already gets a 403 on Subscription today. Needed in Rollenberechtigungen-Manager, read only, level 0:
Document both in erpsetup output as a check (GET returns 403 → report "missing permission").
Tests
erpmock: GET /api/resource/Sales Invoice with filters
server: reconcile with one invoice 1 / 15 / 31 days overdue → warning / restricted / halted; paid → back to active
## Problem
On the live ERPNext (v15), the `sales_invoice.overdue` webhook never fires. ERPNext marks invoices Overdue in the daily scheduler job `erpnext.controllers.accounts_controller.update_invoice_status`, which runs a bulk `UPDATE ... SET status='Overdue'` through the query builder. That write skips document events (`on_update_after_submit`), so the Frappe Webhook `breakpilot-sales_invoice.overdue` is never triggered.
As a result, on production the ladder path **active → warning → restricted (14 d) → halted (30 d)** for unpaid invoices does not happen. A customer who never pays stays `active`. On staging only the erpmock fired this event, so gate 04 did not catch it.
Found on 2026-09-30 during the SEPA trial run on prod (bp-smoketest).
## Fix
Run it from `Reconcile` (every 15 min), which already walks every tenant that has an `ErpCustomerID`:
- query `Sales Invoice` with `customer = <ErpCustomerID>`, `docstatus = 1`, `outstanding_amount > 0` and `due_date < today` (fields `name`, `due_date`, `outstanding_amount`);
- `days_overdue` = today (Europe/Berlin) − the oldest `due_date`;
- apply the same rungs as the webhook handler (`restrictAfterDays` / `haltAfterDays`, never move backwards, ignore demo/halted/archived). Share the code with the `EventInvoiceOverdue` case;
- write the audit entry with source `reconcile:invoice_overdue:<invoice>`.
Return to `active` is already handled by `payment_entry.submit`, and that event does fire. As a safety net, reconcile should also move `warning`/`restricted` back to `active` when no overdue invoice is left, e.g. after a payment reconciliation (Zahlungsabgleich), which fires no event.
Keep the webhook: it's harmless, and it would help if a later ERPNext version fires events on that update.
## ERPNext permission (manual)
The API user `platform-registry@breakpilot.com` has the roles Sales User and Stock User. Neither **Sales Invoice** nor **Subscription** has a Sales User permission row, so reconcile already gets a 403 on Subscription today. Needed in Rollenberechtigungen-Manager, **read only**, level 0:
- Abonnement (Subscription): Vertriebsbenutzer (Sales User)
- Ausgangsrechnung (Sales Invoice): Vertriebsbenutzer (Sales User)
Document both in `erpsetup` output as a check (GET returns 403 → report "missing permission").
## Tests
- erpmock: `GET /api/resource/Sales Invoice` with filters
- server: reconcile with one invoice 1 / 15 / 31 days overdue → warning / restricted / halted; paid → back to active
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
On the live ERPNext (v15), the
sales_invoice.overduewebhook never fires. ERPNext marks invoices Overdue in the daily scheduler joberpnext.controllers.accounts_controller.update_invoice_status, which runs a bulkUPDATE ... SET status='Overdue'through the query builder. That write skips document events (on_update_after_submit), so the Frappe Webhookbreakpilot-sales_invoice.overdueis never triggered.As a result, on production the ladder path active → warning → restricted (14 d) → halted (30 d) for unpaid invoices does not happen. A customer who never pays stays
active. On staging only the erpmock fired this event, so gate 04 did not catch it.Found on 2026-09-30 during the SEPA trial run on prod (bp-smoketest).
Fix
Run it from
Reconcile(every 15 min), which already walks every tenant that has anErpCustomerID:Sales Invoicewithcustomer = <ErpCustomerID>,docstatus = 1,outstanding_amount > 0anddue_date < today(fieldsname,due_date,outstanding_amount);days_overdue= today (Europe/Berlin) − the oldestdue_date;restrictAfterDays/haltAfterDays, never move backwards, ignore demo/halted/archived). Share the code with theEventInvoiceOverduecase;reconcile:invoice_overdue:<invoice>.Return to
activeis already handled bypayment_entry.submit, and that event does fire. As a safety net, reconcile should also movewarning/restrictedback toactivewhen no overdue invoice is left, e.g. after a payment reconciliation (Zahlungsabgleich), which fires no event.Keep the webhook: it's harmless, and it would help if a later ERPNext version fires events on that update.
ERPNext permission (manual)
The API user
platform-registry@breakpilot.comhas the roles Sales User and Stock User. Neither Sales Invoice nor Subscription has a Sales User permission row, so reconcile already gets a 403 on Subscription today. Needed in Rollenberechtigungen-Manager, read only, level 0:Document both in
erpsetupoutput as a check (GET returns 403 → report "missing permission").Tests
GET /api/resource/Sales Invoicewith filters