mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-12 03:15:07 +00: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
|
import frappe
|
||||||
from frappe import _
|
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
|
import erpnext
|
||||||
|
|
||||||
@@ -223,15 +223,6 @@ def create_material_request(material_requests):
|
|||||||
mr_list = []
|
mr_list = []
|
||||||
exceptions_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({})
|
company_wise_mr = frappe._dict({})
|
||||||
for request_type in material_requests:
|
for request_type in material_requests:
|
||||||
for company in material_requests[request_type]:
|
for company in material_requests[request_type]:
|
||||||
@@ -305,8 +296,9 @@ def create_material_request(material_requests):
|
|||||||
|
|
||||||
company_wise_mr.setdefault(company, []).append(mr)
|
company_wise_mr.setdefault(company, []).append(mr)
|
||||||
|
|
||||||
except Exception:
|
except Exception as exception:
|
||||||
_log_exception(mr)
|
exceptions_list.append(exception)
|
||||||
|
mr.log_error("Unable to create material request")
|
||||||
|
|
||||||
if company_wise_mr:
|
if company_wise_mr:
|
||||||
if getattr(frappe.local, "reorder_email_notify", None) is None:
|
if getattr(frappe.local, "reorder_email_notify", None) is None:
|
||||||
@@ -391,10 +383,7 @@ def notify_errors(exceptions_list):
|
|||||||
|
|
||||||
for exception in exceptions_list:
|
for exception in exceptions_list:
|
||||||
try:
|
try:
|
||||||
exception = json.loads(exception)
|
error_message = f"<div class='small text-muted'>{escape_html(str(exception))}</div><br>"
|
||||||
error_message = """<div class='small text-muted'>{}</div><br>""".format(
|
|
||||||
_(exception.get("message"))
|
|
||||||
)
|
|
||||||
content += error_message
|
content += error_message
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user