mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 15:11:52 +00:00
fix(stock): savepoint repost loop in Stock Ledger Invariant Check (Postgres)
Same shape: the rows loop submits a Repost Item Valuation; a caught DuplicateEntryError poisons the Postgres txn so the next iteration's submit raises InFailedSqlTransaction. Savepoint + rollback(save_point=) before continue. No-op on MariaDB.
This commit is contained in:
@@ -304,6 +304,7 @@ def create_reposting_entries(rows: str | list, item_code: str | None = None, war
|
||||
for row in rows:
|
||||
row = frappe._dict(row)
|
||||
|
||||
frappe.db.savepoint("repost_invariant_check")
|
||||
try:
|
||||
doc = frappe.get_doc(
|
||||
{
|
||||
@@ -320,6 +321,7 @@ def create_reposting_entries(rows: str | list, item_code: str | None = None, war
|
||||
|
||||
entries.append(get_link_to_form("Repost Item Valuation", doc.name))
|
||||
except frappe.DuplicateEntryError:
|
||||
frappe.db.rollback(save_point="repost_invariant_check")
|
||||
continue
|
||||
|
||||
if entries:
|
||||
|
||||
Reference in New Issue
Block a user