* fix: keep status as In Progress for RIV for Timeout Error (#42274)
(cherry picked from commit 10280d6140)
# Conflicts:
# erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
* chore: fix conflicts
---------
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -237,9 +237,23 @@ def repost(doc):
|
|||||||
doc.log_error("Unable to repost item valuation")
|
doc.log_error("Unable to repost item valuation")
|
||||||
|
|
||||||
message = frappe.message_log.pop() if frappe.message_log else ""
|
message = frappe.message_log.pop() if frappe.message_log else ""
|
||||||
|
|
||||||
|
status = "Failed"
|
||||||
|
# If failed because of timeout, set status to In Progress
|
||||||
|
if traceback and "timeout" in traceback.lower():
|
||||||
|
status = "In Progress"
|
||||||
|
|
||||||
if traceback:
|
if traceback:
|
||||||
message += "<br>" + "Traceback: <br>" + traceback
|
message += "<br>" + "Traceback: <br>" + traceback
|
||||||
frappe.db.set_value(doc.doctype, doc.name, "error_log", message)
|
|
||||||
|
frappe.db.set_value(
|
||||||
|
doc.doctype,
|
||||||
|
doc.name,
|
||||||
|
{
|
||||||
|
"error_log": message,
|
||||||
|
"status": status,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
outgoing_email_account = frappe.get_cached_value(
|
outgoing_email_account = frappe.get_cached_value(
|
||||||
"Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name"
|
"Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name"
|
||||||
@@ -247,7 +261,6 @@ def repost(doc):
|
|||||||
|
|
||||||
if outgoing_email_account and not isinstance(e, RecoverableErrors):
|
if outgoing_email_account and not isinstance(e, RecoverableErrors):
|
||||||
notify_error_to_stock_managers(doc, message)
|
notify_error_to_stock_managers(doc, message)
|
||||||
doc.set_status("Failed")
|
|
||||||
finally:
|
finally:
|
||||||
if not frappe.flags.in_test:
|
if not frappe.flags.in_test:
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|||||||
Reference in New Issue
Block a user