diff --git a/frappe/core/doctype/docfield/docfield.json b/frappe/core/doctype/docfield/docfield.json index 9d81c082c0..819b5e40ee 100644 --- a/frappe/core/doctype/docfield/docfield.json +++ b/frappe/core/doctype/docfield/docfield.json @@ -437,7 +437,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Depends On", + "label": "Display Depends On", "length": 255, "no_copy": 0, "oldfieldname": "depends_on", @@ -1012,7 +1012,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-02-22 09:08:47.112186", + "modified": "2016-03-22 15:18:41.237995", "modified_by": "Administrator", "module": "Core", "name": "DocField", diff --git a/frappe/email/doctype/standard_reply/standard_reply.json b/frappe/email/doctype/standard_reply/standard_reply.json index dbe3a5f776..a7486dba12 100644 --- a/frappe/email/doctype/standard_reply/standard_reply.json +++ b/frappe/email/doctype/standard_reply/standard_reply.json @@ -17,6 +17,7 @@ "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Subject", @@ -24,6 +25,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -39,6 +41,7 @@ "fieldtype": "Text Editor", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Response", @@ -46,6 +49,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -62,6 +66,7 @@ "fieldtype": "Link", "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Owner", @@ -70,6 +75,57 @@ "options": "User", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "standard_reply_help", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Standard Reply Help", + "length": 0, + "no_copy": 0, + "options": "
Order Overdue\n\nTransaction {{ doc.name }} has exceeded Due Date. Please take necessary action.\n\nDetails\n\n- Customer: {{ doc.customer }}\n- Amount: {{ doc.grand_total }}\n\n\nThe fieldnames you can use in your standard reply are the fields in the document from which you are sending the email. You can find out the fields of any documents via Setup > Customize Form View and selecting the document type (e.g. Sales Invoice)
\n\nTemplates are compiled using the Jinja Templating Langauge. To learn more about Jinja, read this documentation.
\n", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -81,13 +137,14 @@ "hide_heading": 0, "hide_toolbar": 0, "icon": "icon-comment", + "idx": 0, "in_create": 0, "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2015-11-16 06:29:57.875243", + "modified": "2016-03-22 15:25:43.935671", "modified_by": "Administrator", "module": "Email", "name": "Standard Reply", diff --git a/frappe/email/doctype/standard_reply/standard_reply.py b/frappe/email/doctype/standard_reply/standard_reply.py index 4e73bb3c7a..308f45bb9b 100644 --- a/frappe/email/doctype/standard_reply/standard_reply.py +++ b/frappe/email/doctype/standard_reply/standard_reply.py @@ -2,8 +2,17 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe +import frappe, json from frappe.model.document import Document class StandardReply(Document): - pass \ No newline at end of file + pass + +@frappe.whitelist() +def get_standard_reply(template_name, doc): + '''Returns the processed HTML of a standard reply with the given doc''' + if isinstance(doc, basestring): + doc = json.loads(doc) + + standard_reply = frappe.get_doc("Standard Reply", template_name) + return frappe.render_template(standard_reply.response, doc) \ No newline at end of file diff --git a/frappe/print/doctype/letter_head/letter_head.json b/frappe/print/doctype/letter_head/letter_head.json index 5835626d2f..432cc20067 100644 --- a/frappe/print/doctype/letter_head/letter_head.json +++ b/frappe/print/doctype/letter_head/letter_head.json @@ -16,6 +16,7 @@ "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Letter Head Name", @@ -42,6 +43,7 @@ "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Disabled", @@ -69,6 +71,7 @@ "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Is Default", @@ -96,6 +99,7 @@ "fieldtype": "Text Editor", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Content", @@ -117,10 +121,12 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "depends_on": "letter_head_name", "fieldname": "footer", "fieldtype": "Text Editor", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Footer", @@ -148,7 +154,7 @@ "issingle": 0, "istable": 0, "max_attachments": 3, - "modified": "2016-01-28 02:03:23.139628", + "modified": "2016-03-22 15:18:09.648844", "modified_by": "Administrator", "module": "Print", "name": "Letter Head", diff --git a/frappe/public/js/frappe/views/communication.js b/frappe/public/js/frappe/views/communication.js index 027d9e39e7..63d6c04cc2 100644 --- a/frappe/public/js/frappe/views/communication.js +++ b/frappe/public/js/frappe/views/communication.js @@ -139,7 +139,8 @@ frappe.views.CommunicationComposer = Class.extend({ var me = this; this.dialog.get_input("standard_reply").on("change", function() { var standard_reply = $(this).val(); - var prepend_reply = function() { + + var prepend_reply = function(reply_html) { if(me.reply_added===standard_reply) { return; } @@ -149,30 +150,27 @@ frappe.views.CommunicationComposer = Class.extend({ parts = content.split(''); if(parts.length===2) { - content = [parts[0], frappe.standard_replies[standard_reply], - "