refactored communication and added to Lead / Contact
This commit is contained in:
parent
c4e7b6800a
commit
80127bfb6a
@ -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',
|
||||
},
|
||||
]
|
@ -14,6 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 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()
|
||||
$("<div class='alert'>No Communication with this "
|
||||
+ this.doc.doctype +" yet.</div>").appendTo(this.wrapper);
|
||||
}
|
||||
|
||||
},
|
||||
make_body: function() {
|
||||
$(this.parent)
|
||||
@ -40,26 +49,73 @@ erpnext.CommunicationView = Class.extend({
|
||||
.css({"margin":"10px 0px"});
|
||||
|
||||
this.wrapper = $("<div><h4>Communication History</h4>\
|
||||
<button class='btn btn-small'>Add Reply</button></p></div>")
|
||||
<div style='margin-bottom: 8px;'>\
|
||||
<button class='btn btn-small' \
|
||||
onclick='cur_frm.communication_view.add_reply()'>\
|
||||
<i class='icon-plus'></i> Add Reply</button></div>\
|
||||
</div>")
|
||||
.appendTo(this.parent);
|
||||
|
||||
this.body = $("<table class='table table-bordered table-hover table-striped'>")
|
||||
.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("<p></p><p></p>=== In response to ===<p></p>"
|
||||
+ 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("<br>")== -1 && doc.content.indexOf("<p>")== -1) {
|
||||
doc.content = doc.content.replace(/\n/g, "<br>");
|
||||
}
|
||||
doc.email_address = doc.email_address.replace(/</, "<").replace(/>/, ">");
|
||||
if(!doc.sender) doc.sender = "[unknown sender]";
|
||||
doc.sender = doc.sender.replace(/</, "<").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('<tr><td title="Click to Expand / Collapse">\
|
||||
<p><b>%(email_address)s on %(when)s</b></p>\
|
||||
<p><b>%(sender)s on %(when)s</b> \
|
||||
<a href="#Form/Communication/%(name)s" style="font-size: 90%">\
|
||||
Show Details</a></p>\
|
||||
<div class="comm-content" style="border-top: 1px solid #ddd; padding: 10px; \
|
||||
display: none;"></div>\
|
||||
</td></tr>', doc))
|
||||
|
@ -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
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -24,8 +24,6 @@ from webnotes import session, msgprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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
|
||||
})
|
||||
|
||||
},
|
||||
|
@ -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 + '<p>[Please do not change the subject while responding.]</p>'
|
||||
|
||||
# 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 += '<p>' + signature + '</p>'
|
||||
|
||||
from webnotes.utils.email_lib import sendmail
|
||||
content += '<p>' + signature + '</p>'
|
||||
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)
|
||||
|
@ -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",
|
||||
|
@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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();
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user