mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 07:28:39 +00:00
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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user