fix: Re-order Item Error Email format (#21342)
* fix: Re-order Item Error Email format
* fix: Translated strings
diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py
index 9777673..4c721ac 100644
--- a/erpnext/stock/reorder_item.py
+++ b/erpnext/stock/reorder_item.py
@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
import erpnext
+import json
from frappe.utils import flt, nowdate, add_days, cint
from frappe import _
@@ -198,19 +199,16 @@
subject=_('Auto Material Requests Generated'), message = msg)
def notify_errors(exceptions_list):
- subject = "[Important] [ERPNext] Auto Reorder Errors"
- content = """Dear System Manager,
+ subject = _("[Important] [ERPNext] Auto Reorder Errors")
+ content = _("Dear System Manager,") + "<br>" + _("An error occured for certain Items while creating Material Requests based on Re-order level. \
+ Please rectify these issues :") + "<br>"
-An error occured for certain Items while creating Material Requests based on Re-order level.
+ for exception in exceptions_list:
+ exception = json.loads(exception)
+ error_message = """<div class='small text-muted'>{0}</div><br>""".format(_(exception.get("message")))
+ content += error_message
-Please rectify these issues:
----
-<pre>
-%s
-</pre>
----
-Regards,
-Administrator""" % ("\n\n".join(exceptions_list),)
+ content += _("Regards,") + "<br>" + _("Administrator")
from frappe.email import sendmail_to_system_managers
sendmail_to_system_managers(subject, content)
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index f88ffd4..14674c0 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -126,7 +126,7 @@
frappe.msgprint(_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4}) ")
.format(d.idx, ref_dt, d.get(ref_dn_field), d.rate, ref_rate))
frappe.throw(_("To allow different rates, disable the {0} checkbox in {1}.")
- .format(frappe.bold("Maintain Same Rate Throughout Sales Cycle"),
+ .format(frappe.bold(_("Maintain Same Rate Throughout Sales Cycle")),
get_link_to_form("Selling Settings", "Selling Settings", frappe.bold("Selling Settings"))))
def get_link_filters(self, for_doctype):
@@ -179,4 +179,6 @@
qty = d.get(f)
if qty:
if abs(cint(qty) - flt(qty)) > 0.0000001:
- frappe.throw(_("Quantity ({0}) cannot be a fraction in row {1}").format(qty, d.idx), UOMMustBeIntegerError)
+ frappe.throw(_("Row {1}: Quantity ({0}) cannot be a fraction. To allow this, disable '{2}' in UOM {3}.") \
+ .format(qty, d.idx, frappe.bold(_("Must be Whole Number")), frappe.bold(d.get(uom_field))),
+ UOMMustBeIntegerError)