mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-17 13:55:10 +00:00
fix: validate last_gl_update exists before comparing (#46464)
This commit is contained in:
@@ -605,6 +605,7 @@ def _ensure_idle_system():
|
||||
if frappe.flags.in_test:
|
||||
return
|
||||
|
||||
last_gl_update = None
|
||||
try:
|
||||
# We also lock inserts to GL entry table with for_update here.
|
||||
last_gl_update = frappe.db.get_value("GL Entry", {}, "modified", for_update=True, wait=False)
|
||||
@@ -612,6 +613,9 @@ def _ensure_idle_system():
|
||||
# wait=False fails immediately if there's an active transaction.
|
||||
last_gl_update = add_to_date(None, seconds=-1)
|
||||
|
||||
if not last_gl_update:
|
||||
return
|
||||
|
||||
if last_gl_update > add_to_date(None, minutes=-5):
|
||||
frappe.throw(
|
||||
_(
|
||||
|
||||
Reference in New Issue
Block a user