mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-23 05:04:52 +01:00
Co-authored-by: Sudharsanan Ashok <135326972+Sudharsanan11@users.noreply.github.com> fix(stock): fix email error message (#53606)
This commit is contained in:
@@ -7,7 +7,7 @@ from math import ceil
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import add_days, cint, flt, nowdate
|
||||
from frappe.utils import add_days, cint, escape_html, flt, nowdate
|
||||
|
||||
import erpnext
|
||||
|
||||
@@ -219,15 +219,6 @@ def create_material_request(material_requests):
|
||||
mr_list = []
|
||||
exceptions_list = []
|
||||
|
||||
def _log_exception(mr):
|
||||
if frappe.local.message_log:
|
||||
exceptions_list.extend(frappe.local.message_log)
|
||||
frappe.local.message_log = []
|
||||
else:
|
||||
exceptions_list.append(frappe.get_traceback(with_context=True))
|
||||
|
||||
mr.log_error("Unable to create material request")
|
||||
|
||||
company_wise_mr = frappe._dict({})
|
||||
for request_type in material_requests:
|
||||
for company in material_requests[request_type]:
|
||||
@@ -297,8 +288,9 @@ def create_material_request(material_requests):
|
||||
|
||||
company_wise_mr.setdefault(company, []).append(mr)
|
||||
|
||||
except Exception:
|
||||
_log_exception(mr)
|
||||
except Exception as exception:
|
||||
exceptions_list.append(exception)
|
||||
mr.log_error("Unable to create material request")
|
||||
|
||||
if company_wise_mr:
|
||||
if getattr(frappe.local, "reorder_email_notify", None) is None:
|
||||
@@ -383,10 +375,7 @@ def notify_errors(exceptions_list):
|
||||
|
||||
for exception in exceptions_list:
|
||||
try:
|
||||
exception = json.loads(exception)
|
||||
error_message = """<div class='small text-muted'>{}</div><br>""".format(
|
||||
_(exception.get("message"))
|
||||
)
|
||||
error_message = f"<div class='small text-muted'>{escape_html(str(exception))}</div><br>"
|
||||
content += error_message
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user