mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-13 06:31:48 +00:00
fix(stock): rollback before marking Stock Closing Entry failed (Postgres)
prepare_closing_stock_balance (background job) saves Stock Closing Balance rows + db_set status; on failure the except runs db_set('Failed')+log_error with no rollback, raising InFailedSqlTransaction on Postgres so the doc is never marked Failed and the job dies. Full frappe.db.rollback() before the handler's db_set. No-op on MariaDB.
This commit is contained in:
@@ -152,6 +152,7 @@ def prepare_closing_stock_balance(name):
|
||||
doc.create_stock_closing_balance_entries()
|
||||
doc.db_set("status", "Completed")
|
||||
except Exception:
|
||||
frappe.db.rollback()
|
||||
doc.db_set("status", "Failed")
|
||||
doc.log_error(title="Stock Closing Entry Failed")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user