fix: timeout error in the repost item valuation
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 0cdbbde..22ce4df 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -333,7 +333,9 @@
"erpnext.projects.doctype.project.project.collect_project_status",
"erpnext.hr.doctype.shift_type.shift_type.process_auto_attendance_for_all_shifts",
"erpnext.support.doctype.issue.issue.set_service_level_agreement_variance",
- "erpnext.erpnext_integrations.connectors.shopify_connection.sync_old_orders",
+ "erpnext.erpnext_integrations.connectors.shopify_connection.sync_old_orders"
+ ],
+ "hourly_long": [
"erpnext.stock.doctype.repost_item_valuation.repost_item_valuation.repost_entries"
],
"daily": [
diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
index 5b626ea..55f2ebb 100644
--- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
+++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
@@ -37,6 +37,9 @@
self.db_set('status', status)
def on_submit(self):
+ if not frappe.flags.in_test:
+ return
+
frappe.enqueue(repost, timeout=1800, queue='long',
job_name='repost_sle', now=frappe.flags.in_test, doc=self)
@@ -115,12 +118,6 @@
frappe.sendmail(recipients=recipients, subject=subject, message=message)
def repost_entries():
- job_log = frappe.get_all('Scheduled Job Log', fields = ['status', 'creation'],
- filters = {'scheduled_job_type': 'repost_item_valuation.repost_entries'}, order_by='creation desc', limit=1)
-
- if job_log and job_log[0]['status'] == 'Start' and time_diff_in_hours(now(), job_log[0]['creation']) < 2:
- return
-
riv_entries = get_repost_item_valuation_entries()
for row in riv_entries:
@@ -135,9 +132,7 @@
check_if_stock_and_account_balance_synced(today(), d.name)
def get_repost_item_valuation_entries():
- date = add_to_date(now(), hours=-3)
-
return frappe.db.sql(""" SELECT name from `tabRepost Item Valuation`
WHERE status != 'Completed' and creation <= %s and docstatus = 1
ORDER BY timestamp(posting_date, posting_time) asc, creation asc
- """, date, as_dict=1)
+ """, now(), as_dict=1)