mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 07:01:56 +00:00
fix(stock): savepoint repost loop in Stock and Account Value Comparison (Postgres)
The item/warehouse loop submits a Repost Item Valuation; a DuplicateEntryError poisons the Postgres transaction, so the next iteration's .submit() raises InFailedSqlTransaction. MariaDB continues. Savepoint per iteration + rollback(save_point=) on the caught duplicate (mirrors repost_item_valuation:782). No-op on MariaDB.
This commit is contained in:
@@ -202,6 +202,7 @@ def create_reposting_entries(rows: str | list, company: str):
|
||||
|
||||
for key, sle in item_wh.items():
|
||||
item_code, warehouse = key
|
||||
frappe.db.savepoint("repost_value_comparison")
|
||||
try:
|
||||
doc = frappe.get_doc(
|
||||
{
|
||||
@@ -219,7 +220,7 @@ def create_reposting_entries(rows: str | list, company: str):
|
||||
|
||||
entries.append(get_link_to_form("Repost Item Valuation", doc.name))
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
frappe.db.rollback(save_point="repost_value_comparison")
|
||||
|
||||
if entries:
|
||||
entries = ", ".join(entries)
|
||||
|
||||
Reference in New Issue
Block a user