From 2b966b69cef99c5c0ecafc1f796ba967f50dbc66 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Mon, 29 Jun 2026 20:39:24 +0530 Subject: [PATCH] fix(stock): savepoint per-voucher accounting repost submit (Postgres) make_reposting_for_accounting_ledgers submits a new Repost Item Valuation per voucher in a loop under except Exception. On Postgres a failed submit aborts the transaction so the next iteration's DB work dies with InFailedSqlTransaction; MariaDB continues. Savepoint per iteration, roll back on failure. No-op on MariaDB. --- .../doctype/repost_item_valuation/repost_item_valuation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py index 4be57de747a..b9bb3d931da 100644 --- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py @@ -779,6 +779,7 @@ def make_reposting_for_accounting_ledgers(transactions, company, repost_doc): if reposting_map.get((voucher_type, voucher_no)): continue + frappe.db.savepoint("repost_accounting_ledger") try: new_repost_doc = frappe.new_doc("Repost Item Valuation") new_repost_doc.company = company @@ -789,7 +790,7 @@ def make_reposting_for_accounting_ledgers(transactions, company, repost_doc): new_repost_doc.flags.ignore_permissions = True new_repost_doc.submit() except Exception: - pass + frappe.db.rollback(save_point="repost_accounting_ledger") def get_existing_reposting_only_gl_entries(reposting_reference):