From 0978d0304fbf4e0f54012d34594c608924ab574c Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Mon, 29 Jun 2026 20:39:25 +0530 Subject: [PATCH] test(manufacturing): savepoint duplicate Routing insert in create_routing (Postgres) create_routing inserts a Routing and, on DuplicateEntryError, re-fetches and updates. On Postgres the failed insert aborts the transaction so the get_doc/save in the except raises InFailedSqlTransaction; MariaDB recovers. Savepoint + rollback before the fallback path. --- erpnext/manufacturing/doctype/routing/test_routing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/manufacturing/doctype/routing/test_routing.py b/erpnext/manufacturing/doctype/routing/test_routing.py index 4575c1d1d57..1cec3b657b4 100644 --- a/erpnext/manufacturing/doctype/routing/test_routing.py +++ b/erpnext/manufacturing/doctype/routing/test_routing.py @@ -102,9 +102,11 @@ def create_routing(**args): doc.update(args) if not args.do_not_save: + frappe.db.savepoint("create_routing") try: doc.insert() except frappe.DuplicateEntryError: + frappe.db.rollback(save_point="create_routing") doc = frappe.get_doc("Routing", args.routing_name) doc.delete_key("operations") for operation in args.operations: