|
|
@@ -8,6 +8,7 @@ from frappe import _ |
|
|
|
from frappe.model.document import Document |
|
|
|
from frappe.core.doctype.role.role import get_emails_from_role |
|
|
|
from frappe.utils import validate_email_add, nowdate |
|
|
|
from frappe.utils.data import parse_val |
|
|
|
from frappe.utils.jinja import validate_template |
|
|
|
from frappe.modules.utils import export_module_json, get_doc_module |
|
|
|
from markdown2 import markdown |
|
|
@@ -194,12 +195,10 @@ def evaluate_alert(doc, alert, event): |
|
|
|
|
|
|
|
if event=="Value Change" and not doc.is_new(): |
|
|
|
db_value = frappe.db.get_value(doc.doctype, doc.name, alert.value_changed) |
|
|
|
db_value = parse_val(db_value) |
|
|
|
if (doc.get(alert.value_changed) == db_value) or \ |
|
|
|
(not db_value and not doc.get(alert.value_changed)): |
|
|
|
|
|
|
|
# cast to string if not already for comparing to doc.get's value |
|
|
|
if not isinstance(db_value, basestring): |
|
|
|
db_value = str(frappe.db.get_value(doc.doctype, doc.name, alert.value_changed)) |
|
|
|
|
|
|
|
if doc.get(alert.value_changed) == db_value: |
|
|
|
return # value not changed |
|
|
|
|
|
|
|
if event != "Value Change" and not doc.is_new(): |
|
|
@@ -212,4 +211,4 @@ def evaluate_alert(doc, alert, event): |
|
|
|
frappe.throw(_("Error while evaluating Email Alert {0}. Please fix your template.").format(alert)) |
|
|
|
|
|
|
|
def get_context(doc): |
|
|
|
return {"doc": doc, "nowdate": nowdate, "frappe.utils": frappe.utils} |
|
|
|
return {"doc": doc, "nowdate": nowdate, "frappe.utils": frappe.utils} |