moving support ticket response to communication (wip)

This commit is contained in:
Rushabh Mehta
2012-11-24 14:45:31 +05:30
parent 7d665818b5
commit 17db39dc94
4 changed files with 26 additions and 15 deletions

View File

@@ -86,8 +86,8 @@ $.extend(cur_frm.cscript, {
parent: $a(cur_frm.fields_dict['thread_html'].wrapper, 'div'),
no_result_message: 'No responses yet',
get_query: function() {
return 'select mail, from_email, creation, content_type '+
'from `tabSupport Ticket Response` where parent="'+doc.name+'" order by creation asc'
return 'select content, email_address, creation '+
'from `tabCommunication` where support_ticket="'+doc.name+'" order by creation asc'
},
as_dict: 1,
render_row: function(parent, data, list, idx) {

View File

@@ -64,8 +64,8 @@ class DocType(TransactionBase):
def last_response(self):
"""return last response"""
tmp = webnotes.conn.sql("""select mail from `tabSupport Ticket Response`
where parent = %s order by creation desc limit 1
tmp = webnotes.conn.sql("""select mail from `tabCommunication`
where support_ticket = %s order by creation desc limit 1
""", self.doc.name)
if not tmp:
@@ -84,17 +84,17 @@ class DocType(TransactionBase):
def make_response_record(self, response, from_email = None, content_type='text/plain'):
"""
Creates a new Support Ticket Response record
Creates a new Communication record
"""
# add to Support Ticket Response
# add to Communication
from webnotes.model.doc import Document
d = Document('Support Ticket Response')
d.from_email = from_email or webnotes.user.name
d.parent = self.doc.name
d.parenttype = "Support Ticket"
d.parentfield = "responses"
d.mail = response
d.content_type = content_type
d = Document('Communication')
d.naming_series = "COMM-"
d.subject = self.doc.subject
d.email_address = from_email or webnotes.user.name
d.support_ticket = self.doc.name
d.content = response
d.communication_medium = "Email"
d.save(1)
def close_ticket(self):