From 059b7d7b70b318b5700d15abfe11f28f15ef3c4f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 16 Sep 2016 15:59:57 +0530 Subject: [PATCH] [fix] change subject in email alert, fixes frappe/erpnext#6361 --- .../doctype/email_alert/email_alert.json | 27 ++++++++++++++++--- .../email/doctype/email_alert/email_alert.py | 3 +++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/frappe/email/doctype/email_alert/email_alert.json b/frappe/email/doctype/email_alert/email_alert.json index 709e252afb..8c21ab1d83 100755 --- a/frappe/email/doctype/email_alert/email_alert.json +++ b/frappe/email/doctype/email_alert/email_alert.json @@ -2,17 +2,20 @@ "allow_copy": 0, "allow_import": 0, "allow_rename": 0, - "autoname": "field:subject", + "autoname": "", + "beta": 0, "creation": "2014-07-11 17:18:09.923399", "custom": 0, "docstatus": 0, "doctype": "DocType", "document_type": "System", + "editable_grid": 0, "fields": [ { "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "default": "1", "fieldname": "enabled", "fieldtype": "Check", @@ -38,6 +41,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "filters", "fieldtype": "Section Break", "hidden": 0, @@ -62,6 +66,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "description": "To add dynamic subject, use jinja tags like\n\n
{{ doc.name }} Delivered
", "fieldname": "subject", "fieldtype": "Data", @@ -87,6 +92,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "document_type", "fieldtype": "Link", "hidden": 0, @@ -112,6 +118,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "event", "fieldtype": "Select", "hidden": 0, @@ -137,6 +144,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "depends_on": "eval:doc.event==\"Days After\" || doc.event==\"Days Before\"", "description": "Send alert if date matches this field's value", "fieldname": "date_changed", @@ -163,6 +171,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "default": "0", "depends_on": "eval:doc.event==\"Days After\" || doc.event==\"Days Before\"", "description": "Send days before or after the reference date", @@ -190,6 +199,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "depends_on": "eval:doc.event==\"Value Change\"", "description": "Send alert if this field's value changes", "fieldname": "value_changed", @@ -216,6 +226,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "section_break_9", "fieldtype": "Section Break", "hidden": 0, @@ -240,6 +251,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "depends_on": "", "description": "Optional: The alert will be sent if this expression is true", "fieldname": "condition", @@ -266,6 +278,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "column_break_6", "fieldtype": "Column Break", "hidden": 0, @@ -289,6 +302,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "html_7", "fieldtype": "HTML", "hidden": 0, @@ -313,6 +327,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "column_break_5", "fieldtype": "Section Break", "hidden": 0, @@ -337,6 +352,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "recipients", "fieldtype": "Table", "hidden": 0, @@ -362,6 +378,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "message_sb", "fieldtype": "Section Break", "hidden": 0, @@ -386,6 +403,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "message", "fieldtype": "Text", "hidden": 0, @@ -410,6 +428,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "attach_print", "fieldtype": "Check", "hidden": 0, @@ -435,6 +454,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "message_examples", "fieldtype": "HTML", "hidden": 0, @@ -460,6 +480,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "view_properties", "fieldtype": "Button", "hidden": 0, @@ -486,6 +507,7 @@ "hide_toolbar": 0, "icon": "icon-envelope", "idx": 0, + "image_view": 0, "in_create": 0, "in_dialog": 0, "is_submittable": 0, @@ -493,7 +515,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-05-02 06:16:05.453253", + "modified": "2016-09-16 06:29:18.577597", "modified_by": "Administrator", "module": "Email", "name": "Email Alert", @@ -521,7 +543,6 @@ "write": 1 } ], - "quick_entry": 0, "read_only": 0, "read_only_onload": 0, diff --git a/frappe/email/doctype/email_alert/email_alert.py b/frappe/email/doctype/email_alert/email_alert.py index 7aaa5cea22..a1382b9679 100755 --- a/frappe/email/doctype/email_alert/email_alert.py +++ b/frappe/email/doctype/email_alert/email_alert.py @@ -10,6 +10,9 @@ from frappe.utils import validate_email_add, nowdate from frappe.utils.jinja import validate_template class EmailAlert(Document): + def autoname(self): + self.name = self.subject + def validate(self): validate_template(self.subject) validate_template(self.message)