From 7639a3360e2eab2683c37e040a51d1292dd5e856 Mon Sep 17 00:00:00 2001 From: Kaushal Shriwas <64089478+kaulith@users.noreply.github.com> Date: Thu, 11 Jun 2026 16:04:15 +0530 Subject: [PATCH] test: clean up receivable entries to avoid cross-report leakage --- .../accounts_receivable/test_accounts_receivable.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py index e48883660e6..4a73d62ee2e 100644 --- a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py @@ -1257,6 +1257,15 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase): def test_accounts_receivable_respects_user_permissions(self): # Party is a dynamic link on Payment Ledger Entry, so user permissions on Customer # must be applied explicitly. The report should only show permitted customers. + + # Running the report writes an access log that commits, so these invoices survive + # tearDown's rollback. Delete and commit them so they don't leak into other tests. + def remove_committed_entries(): + self.clear_old_entries() + frappe.db.commit() # nosemgrep + + self.addCleanup(remove_committed_entries) + original_customer = self.customer second_customer = "_Test AR Perm Customer"