From bac4f1de52387ac4de29f7b79d5e93f3d63d9ffc Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sun, 21 Jun 2026 15:48:37 +0530 Subject: [PATCH] fix(postgres): savepoint bank-account creation during company setup create_bank_account() inserts a bank Account and swallows DuplicateEntryError ('bank account same as a CoA entry'). On Postgres the failed insert aborts the transaction, so the rest of company setup ran against a poisoned transaction. Take a savepoint and roll back to it in the handler. No-op on MariaDB. --- erpnext/setup/setup_wizard/operations/install_fixtures.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index 806db071963..1d1edeaf949 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -567,6 +567,7 @@ def create_bank_account(args, demo=False): } ) try: + frappe.db.savepoint("create_bank_account") doc = bank_account.insert() if args.get("set_default"): @@ -583,6 +584,7 @@ def create_bank_account(args, demo=False): except RootNotEditable: frappe.throw(frappe._("Bank account cannot be named as {0}").format(args.get("bank_account"))) except frappe.DuplicateEntryError: + frappe.db.rollback(save_point="create_bank_account") # preserve transaction in postgres # bank account same as a CoA entry pass