mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 23:18:40 +00:00
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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user