Skip to content

Commit

Permalink
fix: keep status as In Progress for RIV for Timeout Error (backport #…
Browse files Browse the repository at this point in the history
…42274) (#42504)

* fix: keep status as In Progress for RIV for Timeout Error (#42274)

(cherry picked from commit 10280d6)

# Conflicts:
#	erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py

* chore: fix conflicts

---------

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Jul 30, 2024
1 parent f42f1bb commit 8e8d0c7
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,30 @@ def repost(doc):
doc.log_error("Unable to repost item valuation")

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:
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(
"Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name"
)

if outgoing_email_account and not isinstance(e, RecoverableErrors):
notify_error_to_stock_managers(doc, message)
doc.set_status("Failed")
finally:
if not frappe.flags.in_test:
frappe.db.commit()
Expand Down

0 comments on commit 8e8d0c7

Please sign in to comment.