[fixes] set lead, contact and company on support ticket
This commit is contained in:
parent
5e50ffa308
commit
e2089fb712
@ -50,7 +50,7 @@ class SupportMailbox(POP3Mailbox):
|
||||
"subject": mail.mail["Subject"],
|
||||
"raised_by": mail.from_email,
|
||||
"content_type": mail.content_type,
|
||||
"status": "Open"
|
||||
"status": "Open",
|
||||
}])
|
||||
ticket.insert()
|
||||
new_ticket = True
|
||||
@ -58,7 +58,7 @@ class SupportMailbox(POP3Mailbox):
|
||||
mail.save_attachments_in_doc(ticket.doc)
|
||||
|
||||
make(content=mail.content, sender=mail.from_email, subject = ticket.doc.subject,
|
||||
doctype="Support Ticket", name=ticket.doc.name,
|
||||
doctype="Support Ticket", name=ticket.doc.name,
|
||||
lead = ticket.doc.lead, contact=ticket.doc.contact, date=mail.date)
|
||||
|
||||
if new_ticket and cint(self.email_settings.send_autoreply) and \
|
||||
|
@ -18,7 +18,6 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
from home import update_feed
|
||||
from webnotes.utils import now
|
||||
|
||||
class DocType(TransactionBase):
|
||||
@ -44,6 +43,7 @@ class DocType(TransactionBase):
|
||||
|
||||
def validate(self):
|
||||
self.update_status()
|
||||
self.set_lead_contact(self.doc.raised_by)
|
||||
|
||||
if self.doc.status == "Closed":
|
||||
from webnotes.widgets.form.assign_to import clear
|
||||
@ -51,10 +51,24 @@ class DocType(TransactionBase):
|
||||
|
||||
def on_communication_sent(self, comm):
|
||||
webnotes.conn.set(self.doc, 'status', 'Waiting for Customer')
|
||||
if comm.lead and not self.doc.lead:
|
||||
webnotes.conn.set(self.doc, 'lead', comm.lead)
|
||||
if comm.contact and not self.doc.contact:
|
||||
webnotes.conn.set(self.doc, 'contact', comm.contact)
|
||||
|
||||
|
||||
def set_lead_contact(self, email_id):
|
||||
import email.utils
|
||||
email_id = email.utils.parseaddr(email_id)
|
||||
if email_id:
|
||||
if not self.doc.lead:
|
||||
self.doc.lead = webnotes.conn.get_value("Lead", {"email_id": email_id})
|
||||
if not self.doc.contact:
|
||||
self.doc.contact = webnotes.conn.get_value("Contact", {"email_id": email_id})
|
||||
|
||||
if not self.doc.company:
|
||||
if self.doc.lead:
|
||||
company = webnotes.conn.get_value("Lead", self.doc.lead, "company")
|
||||
elif self.doc.contact:
|
||||
company = webnotes.conn.get_value("Contact", self.doc.contact, "company")
|
||||
|
||||
self.doc.company = company or webnotes.conn.get_default("company")
|
||||
|
||||
def on_trash(self):
|
||||
webnotes.conn.sql("""update `tabCommunication` set support_ticket=NULL
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-31 22:22:27",
|
||||
"creation": "2013-02-01 10:36:25",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-01-31 22:17:24",
|
||||
"modified": "2013-05-21 16:27:46",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -23,13 +23,18 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Support Ticket",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"submit": 0
|
||||
"report": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
@ -191,6 +196,15 @@
|
||||
"oldfieldtype": "Time",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"print_hide": 1,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.__islocal",
|
||||
"doctype": "DocField",
|
||||
@ -237,51 +251,18 @@
|
||||
"label": "Content Type"
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Guest",
|
||||
"write": 1
|
||||
"role": "Guest"
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"cancel": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "customer",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Customer",
|
||||
"write": 1
|
||||
"role": "Customer"
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Support Team",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"report": 1,
|
||||
"role": "Support Team",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 2,
|
||||
"role": "Support Team"
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user