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.
This commit is contained in:
Mihir Kandoi
2026-06-29 20:39:24 +05:30
parent 864fe50b24
commit 2b966b69ce

View File

@@ -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):