From 80127bfb6ac11483b21d9d01b2aa0a5754ae4a97 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 27 Nov 2012 18:41:35 +0530 Subject: [PATCH] refactored communication and added to Lead / Contact --- patches/patch_list.py | 4 + public/js/communication.js | 74 +++++++++-- selling/doctype/lead/lead.js | 8 +- selling/doctype/lead/lead.py | 2 - selling/doctype/lead/lead.txt | 120 +++++++++--------- .../doctype/communication/communication.py | 66 ++++++++++ .../doctype/communication/communication.txt | 24 ++-- support/doctype/support_ticket/__init__.py | 10 +- .../doctype/support_ticket/support_ticket.js | 8 +- .../doctype/support_ticket/support_ticket.py | 113 +++-------------- .../doctype/support_ticket/support_ticket.txt | 18 +-- utilities/doctype/contact/contact.js | 11 ++ utilities/doctype/contact/contact.py | 8 +- utilities/doctype/contact/contact.txt | 93 ++++++++------ 14 files changed, 308 insertions(+), 251 deletions(-) diff --git a/patches/patch_list.py b/patches/patch_list.py index f54de50885..124fdeacc5 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -683,4 +683,8 @@ patch_list = [ 'patch_module': 'patches.november_2012', 'patch_file': 'support_ticket_response_to_communication', }, + { + 'patch_module': 'patches.november_2012', + 'patch_file': 'communication_sender_and_recipient', + }, ] \ No newline at end of file diff --git a/public/js/communication.js b/public/js/communication.js index 5e7a010144..ee6cce214c 100644 --- a/public/js/communication.js +++ b/public/js/communication.js @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// opts - parent, list, doc, email erpnext.CommunicationView = Class.extend({ init: function(opts) { this.comm_list = []; @@ -27,12 +28,20 @@ erpnext.CommunicationView = Class.extend({ make: function() { var me = this; this.make_body(); - $.each(this.list, function(i, d) { - me.prepare(d); - me.make_line(d); - }); - // show first - this.comm_list[0].find('.comm-content').toggle(true); + + if(this.list && this.list.length) { + $.each(this.list, function(i, d) { + me.prepare(d); + me.make_line(d); + }); + // show first + this.comm_list[0].find('.comm-content').toggle(true); + } else { + this.body.remove() + $("
No Communication with this " + + this.doc.doctype +" yet.
").appendTo(this.wrapper); + } + }, make_body: function() { $(this.parent) @@ -40,26 +49,73 @@ erpnext.CommunicationView = Class.extend({ .css({"margin":"10px 0px"}); this.wrapper = $("

Communication History

\ -

") +
\ +
\ + ") .appendTo(this.parent); this.body = $("") .appendTo(this.wrapper); }, + add_reply: function() { + var me = this; + var d = new wn.ui.Dialog({ + width: 640, + title: "Add Reply: " + (this.doc.subject || ""), + fields: [ + {label:"Subject", fieldtype:"Data", reqd: 1}, + {label:"Message", fieldtype:"Text Editor", reqd: 1, fieldname:"content"}, + {label:"Send Email", fieldtype:"Check"}, + {label:"Send", fieldtype:"Button"}, + ] + }); + + $(d.fields_dict.send_email.input).attr("checked", "checked") + $(d.fields_dict.send.input).click(function() { + var args = d.get_values(); + if(!args) return; + wn.call({ + method:"support.doctype.communication.communication.make", + args: $.extend(args, { + doctype: me.doc.doctype, + name: me.doc.name, + lead: me.doc.lead, + contact: me.doc.contact, + recipients: me.email + }), + callback: function(r) { + d.hide(); + cur_frm.reload_doc(); + } + }); + }); + + d.fields_dict.content.input.set_input("

=== In response to ===

" + + me.list[0].content) + $(d.fields_dict.subject.input).val(this.doc.subject || "").change(); + + d.show(); + }, + prepare: function(doc) { //doc.when = comment_when(this.doc.modified); doc.when = doc.modified; if(doc.content.indexOf("
")== -1 && doc.content.indexOf("

")== -1) { doc.content = doc.content.replace(/\n/g, "
"); } - doc.email_address = doc.email_address.replace(//, ">"); + if(!doc.sender) doc.sender = "[unknown sender]"; + doc.sender = doc.sender.replace(//, ">"); doc.content = doc.content.split("=== In response to ===")[0]; doc.content = doc.content.split("-----Original Message-----")[0]; }, make_line: function(doc) { var me = this; var comm = $(repl('

', doc)) diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js index 5bb4ce7686..39522f86cc 100644 --- a/selling/doctype/lead/lead.js +++ b/selling/doctype/lead/lead.js @@ -17,9 +17,7 @@ // Module CRM wn.require("public/app/js/communication.js"); - wn.require('app/utilities/doctype/sms_control/sms_control.js'); -wn.require('app/support/doctype/communication/communication.js'); cur_frm.cscript.onload = function(doc, cdt, cdn) { if(user =='Guest'){ @@ -70,9 +68,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.refresh_custom_buttons(doc); erpnext.hide_naming_series(); - new erpnext.CommunicationView({ + cur_frm.communication_view = new erpnext.CommunicationView({ list: wn.model.get("Communication", {"lead": doc.name}), - parent: cur_frm.fields_dict.communication_html.wrapper + parent: cur_frm.fields_dict.communication_html.wrapper, + doc: doc, + email: doc.email_id }) } diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py index 236d337105..be11da42ad 100644 --- a/selling/doctype/lead/lead.py +++ b/selling/doctype/lead/lead.py @@ -24,8 +24,6 @@ from webnotes import session, msgprint sql = webnotes.conn.sql -# ----------------------------------------------------------------------------------------- - from utilities.transaction_base import TransactionBase class DocType(TransactionBase): diff --git a/selling/doctype/lead/lead.txt b/selling/doctype/lead/lead.txt index 05292f8089..04a399701e 100644 --- a/selling/doctype/lead/lead.txt +++ b/selling/doctype/lead/lead.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-11-02 17:16:46", "modified_by": "Administrator", - "modified": "2012-11-26 18:13:22" + "modified": "2012-11-27 18:27:47" }, { "autoname": "naming_series:", @@ -36,23 +36,6 @@ "name": "Lead", "doctype": "DocType" }, - { - "oldfieldtype": "Section Break", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Basic Info", - "fieldname": "basic_info", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "oldfieldtype": "Column Break", - "doctype": "DocField", - "width": "50%", - "fieldname": "column_break0", - "fieldtype": "Column Break", - "permlevel": 0 - }, { "description": "To manage multiple series please go to Setup > Manage Series", "no_copy": 1, @@ -93,19 +76,27 @@ "permlevel": 0 }, { - "description": "Name of organization from where lead has come", - "oldfieldtype": "Data", + "doctype": "DocField", + "fieldname": "cb6", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "permlevel": 0, + "no_copy": 1, + "oldfieldtype": "Select", "colour": "White:FFF", "doctype": "DocField", - "label": "Company Name", - "oldfieldname": "company_name", + "label": "Status", + "oldfieldname": "status", + "default": "Open", "trigger": "Client", - "fieldname": "company_name", - "fieldtype": "Data", - "search_index": 0, - "reqd": 0, - "in_filter": 1, - "permlevel": 0 + "fieldname": "status", + "fieldtype": "Select", + "search_index": 1, + "reqd": 1, + "options": "\nOpen\nAttempted to Contact\nContact in Future\nContacted\nInterested\nNot interested\nLead Lost\nConverted", + "in_filter": 1 }, { "description": "Source of the lead. If via a campaign, select \"Campaign\"", @@ -124,6 +115,45 @@ "in_filter": 1, "options": "\nAdvertisement\nBlog\nCampaign\nCall\nCustomer\nExhibition\nSupplier\nWebsite\nEmail" }, + { + "doctype": "DocField", + "fieldname": "communication_history", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "allow_on_submit": 0, + "oldfieldtype": "Table", + "colour": "White:FFF", + "doctype": "DocField", + "label": "Communication HTML", + "oldfieldname": "follow_up", + "fieldname": "communication_html", + "fieldtype": "HTML", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Lead Details", + "fieldname": "sb8", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "description": "Name of organization from where lead has come", + "oldfieldtype": "Data", + "colour": "White:FFF", + "doctype": "DocField", + "label": "Company Name", + "oldfieldname": "company_name", + "trigger": "Client", + "fieldname": "company_name", + "fieldtype": "Data", + "search_index": 0, + "reqd": 0, + "in_filter": 1, + "permlevel": 0 + }, { "description": "Source of th", "oldfieldtype": "Link", @@ -159,23 +189,6 @@ "fieldtype": "Column Break", "permlevel": 0 }, - { - "permlevel": 0, - "no_copy": 1, - "oldfieldtype": "Select", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Status", - "oldfieldname": "status", - "default": "Open", - "trigger": "Client", - "fieldname": "status", - "fieldtype": "Select", - "search_index": 1, - "reqd": 1, - "options": "\nOpen\nAttempted to Contact\nContact in Future\nContacted\nInterested\nNot interested\nLead Lost\nConverted", - "in_filter": 1 - }, { "oldfieldtype": "Select", "colour": "White:FFF", @@ -198,23 +211,6 @@ "fieldtype": "Small Text", "permlevel": 0 }, - { - "doctype": "DocField", - "fieldname": "communication_history", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "oldfieldtype": "Table", - "colour": "White:FFF", - "allow_on_submit": 0, - "doctype": "DocField", - "label": "Communication HTML", - "oldfieldname": "follow_up", - "fieldname": "communication_html", - "fieldtype": "HTML", - "permlevel": 0 - }, { "oldfieldtype": "Column Break", "doctype": "DocField", diff --git a/support/doctype/communication/communication.py b/support/doctype/communication/communication.py index 93174e24f2..f365fe38b4 100644 --- a/support/doctype/communication/communication.py +++ b/support/doctype/communication/communication.py @@ -38,6 +38,72 @@ def get_customer_supplier(args=None): } return {} +@webnotes.whitelist() +def make(doctype=None, name=None, content=None, subject=None, + sender=None, recipients=None, contact=None, lead=None, + communication_medium="Email", send_email=False): + # add to Communication + + sent_via = None + + d = webnotes.doc('Communication') + d.subject = subject + d.content = content + d.sender = sender or webnotes.conn.get_value("Profile", webnotes.session.user, "email") + d.recipients = recipients + d.lead = lead + d.contact = contact + if doctype: + sent_via = webnotes.get_obj(doctype, name) + d.fields[doctype.replace(" ", "_").lower()] = name + + set_lead_and_contact(d) + d.communication_medium = communication_medium + if send_email: + send_comm_email(d, sent_via) + d.save(1) + +def send_comm_email(d, sent_via=None): + from webnotes.utils.email_lib import sendmail + + if sent_via: + if hasattr(sent_via, "get_sender"): + d.sender = sent_via.get_sender(d) + if hasattr(sent_via, "get_subject"): + d.subject = sent_via.get_subject(d) + if hasattr(sent_via, "get_content"): + d.content = sent_via.get_content(d) + + sendmail(\ + recipients = d.recipients.split(","), \ + sender = d.sender, \ + subject = d.subject, \ + msg= d.content) + + if sent_via and hasattr(sent_via, 'on_communication_sent'): + sent_via.on_communication_sent(d) + +def set_lead_and_contact(d): + import email.utils + email_addr = email.utils.parseaddr(d.sender) + # set contact + if not d.contact: + d.contact = webnotes.conn.get_value("Contact", {"email_id": email_addr[1]}, "name") or None + + if not d.lead: + d.lead = webnotes.conn.get_value("Lead", {"email_id": email_addr[1]}, "name") or None + + if not d.lead and not d.contact: + d.lead = make_lead(d, email_addr[0]) + +def make_lead(d, real_name): + lead = webnotes.doc("Lead") + lead.lead_name = real_name or d.sender + lead.email_id = d.sender + lead.source = "Email" + lead.save(1) + return lead.name + class DocType(): def __init__(self, doc, doclist=[]): self.doc = doc diff --git a/support/doctype/communication/communication.txt b/support/doctype/communication/communication.txt index ea457550a7..3d249ab559 100644 --- a/support/doctype/communication/communication.txt +++ b/support/doctype/communication/communication.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-11-14 12:25:16", "modified_by": "Administrator", - "modified": "2012-11-26 12:41:59" + "modified": "2012-11-27 12:24:43" }, { "autoname": "naming_series:", @@ -121,7 +121,6 @@ { "colour": "White:FFF", "doctype": "DocField", - "label": "Related To", "fieldname": "column_break3", "fieldtype": "Column Break", "permlevel": 0 @@ -189,6 +188,20 @@ "fieldtype": "Column Break", "permlevel": 0 }, + { + "doctype": "DocField", + "label": "Recipients", + "fieldname": "recipients", + "fieldtype": "Data", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Sender", + "fieldname": "sender", + "fieldtype": "Data", + "permlevel": 0 + }, { "doctype": "DocField", "label": "Communication Medium", @@ -204,13 +217,6 @@ "fieldtype": "Data", "permlevel": 0 }, - { - "doctype": "DocField", - "label": "Email Address", - "fieldname": "email_address", - "fieldtype": "Data", - "permlevel": 0 - }, { "doctype": "DocField", "options": "simple", diff --git a/support/doctype/support_ticket/__init__.py b/support/doctype/support_ticket/__init__.py index 25eceaa8b6..b477b96450 100644 --- a/support/doctype/support_ticket/__init__.py +++ b/support/doctype/support_ticket/__init__.py @@ -79,13 +79,13 @@ class SupportMailbox(POP3Mailbox): WHERE name=%s AND raised_by REGEXP %s """ , (thread_id, '(' + email_id + ')')) if exists and exists[0] and exists[0][0]: - from webnotes.model.code import get_obj + st = webnotes.get_obj('Support Ticket', thread_id) - st = get_obj('Support Ticket', thread_id) - st.make_response_record(content, full_email_id, content_type) + from support.doctype.communication.communication import make + + make(content=content, sender=full_email_id, doctype="Support Ticket", + name=thread_id, lead = st.doc.lead, contact=st.doc.contact) - # to update modified date - #webnotes.conn.set(st.doc, 'status', 'Open') st.doc.status = 'Open' st.doc.save() diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index b740498863..519d34391d 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -58,13 +58,15 @@ $.extend(cur_frm.cscript, { var comm_list = wn.model.get("Communication", {"support_ticket": doc.name}) comm_list.push({ - "email_address": doc.raised_by, + "sender": doc.raised_by, "modified": doc.creation, "content": doc.description}); - new erpnext.CommunicationView({ + cur_frm.communication_view = new erpnext.CommunicationView({ list: comm_list, - parent: wrapper + parent: wrapper, + doc: doc, + email: doc.raised_by }) }, diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py index e7f3077a56..6a55755265 100644 --- a/support/doctype/support_ticket/support_ticket.py +++ b/support/doctype/support_ticket/support_ticket.py @@ -28,105 +28,26 @@ class DocType(TransactionBase): def onload(self): self.add_communication_list() - - def send_response(self): - """ - Adds a new response to the ticket and sends an email to the sender - """ - if not self.doc.new_response: - webnotes.msgprint("Please write something as a response", raise_exception=1) - - import markdown2 - self.doc.new_response = markdown2.markdown(self.doc.new_response) - - subject = '[' + self.doc.name + '] ' + (self.doc.subject or 'No Subject Specified') - - response = self.doc.new_response + '

[Please do not change the subject while responding.]

' - - # add last response to new response - response += self.last_response() - + + def get_sender(self, comm): + return webnotes.conn.get_value('Email Settings',None,'support_email') + + def get_subject(self, comm): + return '[' + self.doc.name + '] ' + (comm.doc.subject or 'No Subject Specified') + + def get_content(self, comm): signature = webnotes.conn.get_value('Email Settings',None,'support_signature') + content = comm.doc.content if signature: - response += '

' + signature + '

' - - from webnotes.utils.email_lib import sendmail + content += '

' + signature + '

' + return content - sendmail(\ - recipients = [self.doc.raised_by], \ - sender=webnotes.conn.get_value('Email Settings',None,'support_email'), \ - subject=subject, \ - msg=response) - - self.doc.new_response = None + def on_communication_sent(self, comm): webnotes.conn.set(self.doc, 'status', 'Waiting for Customer') - self.make_response_record(response) - self.add_communication_list() - - def last_response(self): - """return last response""" - tmp = webnotes.conn.sql("""select content from `tabCommunication` - where support_ticket = %s order by creation desc limit 1 - """, self.doc.name) - - if not tmp: - tmp = webnotes.conn.sql(""" - SELECT description from `tabSupport Ticket` - where name = %s - """, self.doc.name) - - response_title = "=== In response to ===" - - if tmp and tmp[0][0]: - return "\n\n" + response_title + "\n\n" + tmp[0][0].split(response_title)[0] - else: - return "" - - - def make_response_record(self, response, from_email = None, content_type='text/plain'): - """ - Creates a new Communication record - """ - # add to Communication - d = webnotes.doc('Communication') - d.subject = self.doc.subject - d.email_address = from_email or webnotes.user.name - self.set_lead_and_contact(d) - d.support_ticket = self.doc.name - d.content = response - d.communication_medium = "Email" - d.save(1) - - def set_lead_and_contact(self, d): - import email.utils - email_addr = email.utils.parseaddr(d.email_address) - # set contact - if self.doc.contact: - d.contact = self.doc.contact - else: - d.contact = webnotes.conn.get_value("Contact", {"email_id": email_addr[1]}, "name") or None - if d.contact: - webnotes.conn.set(self.doc, "contact", d.contact) - - if self.doc.lead: - d.lead = self.doc.lead - else: - d.lead = webnotes.conn.get_value("Lead", {"email_id": email_addr[1]}, "name") or None - if d.lead: - webnotes.conn.set(self.doc, "lead", d.lead) - - # not linked to any lead / contact, create new lead - if not d.lead and not d.contact: - d.lead = self.make_lead(d, email_addr[0]) - webnotes.conn.set(self.doc, "lead", d.lead) - - def make_lead(self, d, real_name): - d = webnotes.doc("Lead") - d.lead_name = real_name or d.email_address - d.email_id = d.email_address - d.source = "Email" - d.save(1) - return d.name + if comm.doc.lead and not self.doc.lead: + webnotes.conn.set(self.doc, 'lead', comm.doc.lead) + if comm.doc.contact and not self.doc.contact: + webnotes.conn.set(self.doc, 'contact', comm.doc.contact) def close_ticket(self): webnotes.conn.set(self.doc,'status','Closed') @@ -137,5 +58,5 @@ class DocType(TransactionBase): update_feed(self.doc) def on_trash(self): - webnotes.conn.sql("""update `tabCommunication set support_ticket="" + webnotes.conn.sql("""update `tabCommunication` set support_ticket="" where support_ticket=%s`""", self.doc.name) diff --git a/support/doctype/support_ticket/support_ticket.txt b/support/doctype/support_ticket/support_ticket.txt index 8259954b14..3878d27ebd 100644 --- a/support/doctype/support_ticket/support_ticket.txt +++ b/support/doctype/support_ticket/support_ticket.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-11-02 17:17:05", "modified_by": "Administrator", - "modified": "2012-11-26 12:54:25" + "modified": "2012-11-27 18:21:06" }, { "autoname": "naming_series:", @@ -97,22 +97,6 @@ "reqd": 0, "permlevel": 0 }, - { - "depends_on": "eval:!doc.__islocal", - "doctype": "DocField", - "label": "New Response", - "fieldname": "new_response", - "fieldtype": "Text", - "permlevel": 0 - }, - { - "depends_on": "eval:!doc.__islocal", - "doctype": "DocField", - "label": "Send", - "fieldname": "send", - "fieldtype": "Button", - "permlevel": 0 - }, { "depends_on": "eval:!doc.__islocal", "doctype": "DocField", diff --git a/utilities/doctype/contact/contact.js b/utilities/doctype/contact/contact.js index 5bf95100b0..0a33e08620 100644 --- a/utilities/doctype/contact/contact.js +++ b/utilities/doctype/contact/contact.js @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +wn.require("public/app/js/communication.js"); + //--------- ONLOAD ------------- cur_frm.cscript.onload = function(doc, cdt, cdn) { cur_frm.add_fetch('customer', 'customer_name', 'customer_name'); @@ -40,6 +42,15 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { } } +cur_frm.cscript.refresh = function() { + cur_frm.communication_view = new erpnext.CommunicationView({ + list: wn.model.get("Communication", {"contact": doc.name}), + parent: cur_frm.fields_dict.communication_html.wrapper, + doc: doc, + email: doc.email_id + }) +} + cur_frm.cscript.hide_dialog = function() { if(cur_frm.contact_list) cur_frm.contact_list.run(); diff --git a/utilities/doctype/contact/contact.py b/utilities/doctype/contact/contact.py index 92adaf429b..d9807330e8 100644 --- a/utilities/doctype/contact/contact.py +++ b/utilities/doctype/contact/contact.py @@ -21,12 +21,16 @@ import webnotes from webnotes.model.doc import Document from webnotes import session, form, msgprint, errprint -# ----------------------------------------------------------------------------------------- -class DocType: +from utilities.transaction_base import TransactionBase + +class DocType(TransactionBase): def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist + def onload(self): + self.add_communication_list() + def autoname(self): if self.doc.customer: self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.customer diff --git a/utilities/doctype/contact/contact.txt b/utilities/doctype/contact/contact.txt index 20aa07608f..e8813b5372 100644 --- a/utilities/doctype/contact/contact.txt +++ b/utilities/doctype/contact/contact.txt @@ -4,14 +4,14 @@ "docstatus": 0, "creation": "2012-08-06 11:15:46", "modified_by": "Administrator", - "modified": "2012-11-24 15:10:53" + "modified": "2012-11-27 18:32:42" }, { "in_create": 0, "default_print_format": "Standard", "doctype": "DocType", "module": "Utilities", - "in_dialog": 1, + "in_dialog": 0, "document_type": "Master", "name": "__common__" }, @@ -34,23 +34,6 @@ "name": "Contact", "doctype": "DocType" }, - { - "oldfieldtype": "Section Break", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Contact Details", - "fieldname": "contact_details", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "oldfieldtype": "Column Break", - "doctype": "DocField", - "width": "50%", - "fieldname": "column_break0", - "fieldtype": "Column Break", - "permlevel": 0 - }, { "oldfieldtype": "Data", "doctype": "DocField", @@ -70,6 +53,54 @@ "fieldtype": "Data", "permlevel": 0 }, + { + "doctype": "DocField", + "fieldname": "cb00", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "oldfieldtype": "Data", + "colour": "White:FFF", + "doctype": "DocField", + "label": "Email Id", + "oldfieldname": "email_id", + "fieldname": "email_id", + "fieldtype": "Data", + "search_index": 1, + "reqd": 1, + "permlevel": 0 + }, + { + "oldfieldtype": "Data", + "doctype": "DocField", + "label": "Phone", + "oldfieldname": "contact_no", + "fieldname": "phone", + "fieldtype": "Data", + "reqd": 1, + "permlevel": 0 + }, + { + "doctype": "DocField", + "fieldname": "sb00", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Communication HTML", + "fieldname": "communication_html", + "fieldtype": "HTML", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Contact Details", + "fieldname": "contact_details", + "fieldtype": "Section Break", + "permlevel": 0 + }, { "print_hide": 0, "oldfieldtype": "Link", @@ -105,9 +136,9 @@ "permlevel": 0 }, { + "allow_on_submit": 0, "depends_on": "eval:!doc.customer && !doc.sales_partner", "colour": "White:FFF", - "allow_on_submit": 0, "doctype": "DocField", "label": "Supplier Name", "fieldname": "supplier_name", @@ -144,28 +175,6 @@ "fieldtype": "Column Break", "permlevel": 0 }, - { - "oldfieldtype": "Data", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Email Id", - "oldfieldname": "email_id", - "fieldname": "email_id", - "fieldtype": "Data", - "search_index": 1, - "reqd": 1, - "permlevel": 0 - }, - { - "oldfieldtype": "Data", - "doctype": "DocField", - "label": "Phone", - "oldfieldname": "contact_no", - "fieldname": "phone", - "fieldtype": "Data", - "reqd": 1, - "permlevel": 0 - }, { "oldfieldtype": "Data", "doctype": "DocField",
\ -

%(email_address)s on %(when)s

\ +

%(sender)s on %(when)s \ + \ + Show Details

\
\