diff --git a/frappe/config/setup.py b/frappe/config/setup.py index a47bf25ccf..c72cd4c6d7 100644 --- a/frappe/config/setup.py +++ b/frappe/config/setup.py @@ -162,8 +162,8 @@ def get_data(): }, { "type": "doctype", - "name": "Standard Reply", - "description": _("Standard replies to common queries.") + "name": "Email Template", + "description": _("Email Templates for common queries.") }, { "type": "doctype", diff --git a/frappe/email/doctype/standard_reply/__init__.py b/frappe/email/doctype/email_template/__init__.py similarity index 100% rename from frappe/email/doctype/standard_reply/__init__.py rename to frappe/email/doctype/email_template/__init__.py diff --git a/frappe/email/doctype/email_template/email_template.js b/frappe/email/doctype/email_template/email_template.js new file mode 100644 index 0000000000..62ce4d94ad --- /dev/null +++ b/frappe/email/doctype/email_template/email_template.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, Frappe Technologies and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Email Template', { + refresh: function() { + + } +}); diff --git a/frappe/email/doctype/standard_reply/standard_reply.json b/frappe/email/doctype/email_template/email_template.json similarity index 82% rename from frappe/email/doctype/standard_reply/standard_reply.json rename to frappe/email/doctype/email_template/email_template.json index 4765e3f3ad..b7b12bf316 100644 --- a/frappe/email/doctype/standard_reply/standard_reply.json +++ b/frappe/email/doctype/email_template/email_template.json @@ -40,6 +40,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -69,6 +70,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -100,6 +102,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -129,6 +132,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -137,7 +141,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "standard_reply_help", + "fieldname": "email_reply_help", "fieldtype": "HTML", "hidden": 0, "ignore_user_permissions": 0, @@ -146,10 +150,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Standard Reply Help", + "label": "Email Reply Help", "length": 0, "no_copy": 0, - "options": "
Order Overdue\n\nTransaction {{ name }} has exceeded Due Date. Please take necessary action.\n\nDetails\n\n- Customer: {{ customer }}\n- Amount: {{ 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", + "options": "Order Overdue\n\nTransaction {{ name }} has exceeded Due Date. Please take necessary action.\n\nDetails\n\n- Customer: {{ customer }}\n- Amount: {{ grand_total }}\n\n\nThe fieldnames you can use in your email template 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, @@ -160,6 +164,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], @@ -174,16 +179,15 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-11-10 08:25:07.708599", + "modified": "2018-04-14 16:46:39.792082", "modified_by": "Administrator", "module": "Email", - "name": "Standard Reply", + "name": "Email Template", "name_case": "", "owner": "Administrator", "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 0, @@ -203,7 +207,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, diff --git a/frappe/email/doctype/standard_reply/standard_reply.py b/frappe/email/doctype/email_template/email_template.py old mode 100755 new mode 100644 similarity index 57% rename from frappe/email/doctype/standard_reply/standard_reply.py rename to frappe/email/doctype/email_template/email_template.py index 17828cb352..2743032331 --- a/frappe/email/doctype/standard_reply/standard_reply.py +++ b/frappe/email/doctype/email_template/email_template.py @@ -7,16 +7,16 @@ from frappe.model.document import Document from frappe.utils.jinja import validate_template from six import string_types -class StandardReply(Document): +class EmailTemplate(Document): def validate(self): validate_template(self.response) @frappe.whitelist() -def get_standard_reply(template_name, doc): - '''Returns the processed HTML of a standard reply with the given doc''' +def get_email_template(template_name, doc): + '''Returns the processed HTML of a email template with the given doc''' if isinstance(doc, string_types): doc = json.loads(doc) - standard_reply = frappe.get_doc("Standard Reply", template_name) - return {"subject" : frappe.render_template(standard_reply.subject, doc), - "message" : frappe.render_template(standard_reply.response, doc)} \ No newline at end of file + email_template = frappe.get_doc("Email Template", template_name) + return {"subject" : frappe.render_template(email_template.subject, doc), + "message" : frappe.render_template(email_template.response, doc)} \ No newline at end of file diff --git a/frappe/email/doctype/standard_reply/test_standard_reply.js b/frappe/email/doctype/email_template/test_email_template.js similarity index 71% rename from frappe/email/doctype/standard_reply/test_standard_reply.js rename to frappe/email/doctype/email_template/test_email_template.js index 03e601fdd3..529dd14184 100644 --- a/frappe/email/doctype/standard_reply/test_standard_reply.js +++ b/frappe/email/doctype/email_template/test_email_template.js @@ -2,15 +2,15 @@ // rename this file from _test_[name] to test_[name] to activate // and remove above this line -QUnit.test("test: Standard Reply", function (assert) { +QUnit.test("test: Email Template", function (assert) { let done = assert.async(); // number of asserts assert.expect(1); frappe.run_serially([ - // insert a new Standard Reply - () => frappe.tests.make('Standard Reply', [ + // insert a new Email Template + () => frappe.tests.make('Email Template', [ // values to be set {key: 'value'} ]), diff --git a/frappe/email/doctype/email_template/test_email_template.py b/frappe/email/doctype/email_template/test_email_template.py new file mode 100644 index 0000000000..a48ce94ac5 --- /dev/null +++ b/frappe/email/doctype/email_template/test_email_template.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import unittest + +class TestEmailTemplate(unittest.TestCase): + pass diff --git a/frappe/email/doctype/standard_reply/standard_reply.js b/frappe/email/doctype/standard_reply/standard_reply.js deleted file mode 100644 index a06fca1cba..0000000000 --- a/frappe/email/doctype/standard_reply/standard_reply.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2016, Frappe Technologies and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Standard Reply', { - refresh: function(frm) { - - } -}); diff --git a/frappe/email/doctype/standard_reply/test_standard_reply.py b/frappe/email/doctype/standard_reply/test_standard_reply.py deleted file mode 100644 index 9255716b12..0000000000 --- a/frappe/email/doctype/standard_reply/test_standard_reply.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# See license.txt -from __future__ import unicode_literals - -import frappe -import unittest - -# test_records = frappe.get_test_records('Standard Reply') - -class TestStandardReply(unittest.TestCase): - pass diff --git a/frappe/patches.txt b/frappe/patches.txt index a6f1c1aa4e..d687ffdfde 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -206,3 +206,4 @@ frappe.patches.v10_0.refactor_social_login_keys frappe.patches.v10_0.enable_chat_by_default_within_system_settings frappe.patches.v10_0.remove_custom_field_for_disabled_domain execute:frappe.delete_doc("Page", "chat") +frappe.patches.v11_0.rename_standard_reply_to_email_template \ No newline at end of file diff --git a/frappe/patches/v11_0/rename_standard_reply_to_email_template.py b/frappe/patches/v11_0/rename_standard_reply_to_email_template.py new file mode 100644 index 0000000000..364a7a5de5 --- /dev/null +++ b/frappe/patches/v11_0/rename_standard_reply_to_email_template.py @@ -0,0 +1,7 @@ +import frappe +from frappe.model.rename_doc import rename_doc + +def execute(): + if frappe.db.table_exists("Standard Reply") and not frappe.db.table_exists("Email Template"): + rename_doc('DocType', 'Standard Reply', 'Email Template') + frappe.reload_doc('setup', 'doctype', 'email_template') diff --git a/frappe/public/js/frappe/views/communication.js b/frappe/public/js/frappe/views/communication.js index bbbd42aee9..1a8ddb0b74 100755 --- a/frappe/public/js/frappe/views/communication.js +++ b/frappe/public/js/frappe/views/communication.js @@ -48,11 +48,11 @@ frappe.views.CommunicationComposer = Class.extend({ get_fields: function() { var fields= [ {label:__("To"), fieldtype:"Data", reqd: 0, fieldname:"recipients",length:524288}, - {fieldtype: "Section Break", collapsible: 1, label: __("CC, BCC & Standard Reply")}, + {fieldtype: "Section Break", collapsible: 1, label: __("CC, BCC & Email Template")}, {label:__("CC"), fieldtype:"Data", fieldname:"cc", length:524288}, {label:__("BCC"), fieldtype:"Data", fieldname:"bcc", length:524288}, - {label:__("Standard Reply"), fieldtype:"Link", options:"Standard Reply", - fieldname:"standard_reply"}, + {label:__("Email Template"), fieldtype:"Link", options:"Email Template", + fieldname:"email_template"}, {fieldtype: "Section Break"}, {label:__("Subject"), fieldtype:"Data", reqd: 1, fieldname:"subject", length:524288}, @@ -106,7 +106,7 @@ frappe.views.CommunicationComposer = Class.extend({ this.setup_email(); this.setup_awesomplete(); this.setup_last_edited_communication(); - this.setup_standard_reply(); + this.setup_email_template(); this.dialog.fields_dict.recipients.set_value(this.recipients || ''); this.dialog.fields_dict.cc.set_value(this.cc || ''); @@ -163,14 +163,14 @@ frappe.views.CommunicationComposer = Class.extend({ } }, - setup_standard_reply: function() { + setup_email_template: function() { var me = this; - this.dialog.fields_dict["standard_reply"].df.onchange = () => { - var standard_reply = me.dialog.fields_dict.standard_reply.get_value(); + this.dialog.fields_dict["email_template"].df.onchange = () => { + var email_template = me.dialog.fields_dict.email_template.get_value(); var prepend_reply = function(reply) { - if(me.reply_added===standard_reply) { + if(me.reply_added===email_template) { return; } var content_field = me.dialog.fields_dict.content; @@ -191,13 +191,13 @@ frappe.views.CommunicationComposer = Class.extend({ subject_field.set_value(reply.subject); } - me.reply_added = standard_reply; + me.reply_added = email_template; } frappe.call({ - method: 'frappe.email.doctype.standard_reply.standard_reply.get_standard_reply', + method: 'frappe.email.doctype.email_template.email_template.get_email_template', args: { - template_name: standard_reply, + template_name: email_template, doc: me.frm.doc, _lang: me.dialog.get_value("language_sel") },