support ticket updates
This commit is contained in:
parent
627d01bd4b
commit
3333ca1721
@ -1,4 +1,5 @@
|
||||
import webnotes
|
||||
from webnotes import msgprint
|
||||
|
||||
feed_dict = {
|
||||
# Project
|
||||
@ -29,12 +30,45 @@ feed_dict = {
|
||||
# Support
|
||||
'Customer Issue': ['[%(status)s] %(description)s by %(customer_name)s', '#000080'],
|
||||
'Maintenance Visit':['To %(customer_name)s', '#4169E1'],
|
||||
'Support Ticket': ['[%(status)s] %(subject)s', '#000080']
|
||||
#'Support Ticket': ['[%(status)s] %(subject)s', '#000080']
|
||||
'Support Ticket': '#000080'
|
||||
}
|
||||
|
||||
feed_dict_color = {
|
||||
# Project
|
||||
'Project': '#000080',
|
||||
|
||||
# Sales
|
||||
'Lead': '#000080',
|
||||
'Quotation': '#4169E1',
|
||||
'Sales Order': '#4169E1',
|
||||
|
||||
# Purchase
|
||||
'Supplier': '#6495ED',
|
||||
'Purchase Order': '#4169E1',
|
||||
|
||||
# Stock
|
||||
'Delivery Note': '#4169E1',
|
||||
|
||||
# Accounts
|
||||
'Journal Voucher': '#4169E1',
|
||||
'Payable Voucher': '#4169E1',
|
||||
'Receivable Voucher': '#4169E1',
|
||||
|
||||
# HR
|
||||
'Expense Voucher': '#4169E1',
|
||||
'Salary Slip': '#4169E1',
|
||||
'Leave Transaction': '#4169E1',
|
||||
|
||||
# Support
|
||||
'Customer Issue': '#000080',
|
||||
'Maintenance Visit': '#4169E1',
|
||||
'Support Ticket': '#000080'
|
||||
}
|
||||
|
||||
def make_feed(doc, subject, color):
|
||||
"makes a new Feed record"
|
||||
#msgprint(subject)
|
||||
from webnotes.model.doc import Document
|
||||
webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name))
|
||||
f = Document('Feed')
|
||||
@ -46,8 +80,14 @@ def make_feed(doc, subject, color):
|
||||
|
||||
def update_feed(doc):
|
||||
"adds a new feed"
|
||||
subject, color = feed_dict.get(doc.doctype, [None, None])
|
||||
prop_rec = webnotes.conn.sql("select value from `tabProperty Setter` where doc_type = %s and property = 'subject'", (doc.doctype))
|
||||
if prop_rec:
|
||||
subject = prop_rec[0][0]
|
||||
else:
|
||||
rec = webnotes.conn.sql("select subject from tabDocType where name=%s", (doc.doctype))
|
||||
subject = rec[0][0]
|
||||
|
||||
subject, color = [subject, feed_dict_color.get(doc.doctype)]
|
||||
if subject:
|
||||
subject = subject % doc.fields
|
||||
make_feed(doc, subject, color)
|
||||
|
||||
|
@ -54,7 +54,8 @@ class SupportMailbox(POP3Mailbox):
|
||||
d.save(1)
|
||||
|
||||
# update feed
|
||||
update_feed(d)
|
||||
update_feed(d)
|
||||
|
||||
|
||||
def get_support_mails():
|
||||
"""
|
||||
|
@ -33,8 +33,14 @@ $.extend(cur_frm.cscript, {
|
||||
|
||||
refresh: function(doc) {
|
||||
cs.make_listing(doc);
|
||||
if(!doc.__islocal) {
|
||||
// can't change the main message & subject once set
|
||||
if(!doc.__islocal) {
|
||||
|
||||
if(doc.allocated_to)
|
||||
set_field_permlevel('status',2);
|
||||
if(user==doc.allocated_to && doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cs['Close Ticket']);
|
||||
if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cs['Re-Open Ticket']);
|
||||
|
||||
// can't change the main message & subject once set
|
||||
set_field_permlevel('subject',2);
|
||||
set_field_permlevel('description',2);
|
||||
set_field_permlevel('raised_by',2);
|
||||
@ -87,10 +93,37 @@ $.extend(cur_frm.cscript, {
|
||||
}
|
||||
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
|
||||
if(doc.customer) unhide_field(['customer_name','address_display','contact_display','contact_mobile','contact_email']);
|
||||
},
|
||||
|
||||
'Close Ticket': function() {
|
||||
var doc = cur_frm.doc
|
||||
|
||||
var answer = confirm("Close Ticket "+doc.name+"?\n\nAllocated To: "+doc.allocated_to+"\n\nSubject: "+doc.subject+"");
|
||||
if(answer) {
|
||||
if(doc.name)
|
||||
$c_obj([doc],'close_ticket','',function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
'Re-Open Ticket': function() {
|
||||
var doc = cur_frm.doc
|
||||
|
||||
var answer = confirm("Re-Open Ticket "+doc.name+"?\n\nAllocated To: "+doc.allocated_to+"\n\nSubject: "+doc.subject+"");
|
||||
if(answer) {
|
||||
if(doc.name)
|
||||
$c_obj([doc],'reopen_ticket','',function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
EmailMessage = function(parent, args, list, idx) {
|
||||
var me = this;
|
||||
$.extend(this, args);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import webnotes
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
from home import update_feed
|
||||
|
||||
class DocType(TransactionBase):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
@ -46,3 +47,11 @@ class DocType(TransactionBase):
|
||||
d.mail = response
|
||||
d.content_type = content_type
|
||||
d.save(1)
|
||||
|
||||
def close_ticket(self):
|
||||
webnotes.conn.set(self.doc,'status','Closed')
|
||||
update_feed(self.doc)
|
||||
|
||||
def reopen_ticket(self):
|
||||
webnotes.conn.set(self.doc,'status','Open')
|
||||
update_feed(self.doc)
|
||||
|
@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
'_last_update': '1308914721',
|
||||
'_last_update': '1309771514',
|
||||
'allow_attach': None,
|
||||
'allow_copy': None,
|
||||
'allow_email': None,
|
||||
@ -29,7 +29,7 @@
|
||||
'istable': None,
|
||||
'max_attachments': None,
|
||||
'menu_index': None,
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Maintenance',
|
||||
'name': 'Support Ticket',
|
||||
@ -53,7 +53,7 @@
|
||||
'subject': '%(subject)s',
|
||||
'tag_fields': 'status,allocated_to',
|
||||
'use_template': None,
|
||||
'version': 143
|
||||
'version': 148
|
||||
},
|
||||
{
|
||||
'amend': 0,
|
||||
@ -65,7 +65,7 @@
|
||||
'execute': None,
|
||||
'idx': 1,
|
||||
'match': None,
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00823',
|
||||
'owner': 'Administrator',
|
||||
@ -88,7 +88,7 @@
|
||||
'execute': None,
|
||||
'idx': 2,
|
||||
'match': 'customer',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00824',
|
||||
'owner': 'Administrator',
|
||||
@ -111,7 +111,7 @@
|
||||
'execute': None,
|
||||
'idx': 3,
|
||||
'match': None,
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00825',
|
||||
'owner': 'Administrator',
|
||||
@ -134,7 +134,7 @@
|
||||
'execute': None,
|
||||
'idx': 4,
|
||||
'match': 'allocated_to',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00826',
|
||||
'owner': 'Administrator',
|
||||
@ -157,7 +157,7 @@
|
||||
'execute': None,
|
||||
'idx': 5,
|
||||
'match': None,
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'PERM00827',
|
||||
'owner': 'Administrator',
|
||||
@ -186,7 +186,7 @@
|
||||
'idx': 1,
|
||||
'in_filter': 0,
|
||||
'label': 'Status',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04803',
|
||||
'no_column': None,
|
||||
@ -201,7 +201,7 @@
|
||||
'permlevel': 1,
|
||||
'print_hide': None,
|
||||
'report_hide': None,
|
||||
'reqd': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': None,
|
||||
'width': None
|
||||
@ -216,13 +216,13 @@
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'subject',
|
||||
'fieldtype': 'Text',
|
||||
'fieldtype': 'Small Text',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'in_filter': 1,
|
||||
'label': 'Subject',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04804',
|
||||
'no_column': None,
|
||||
@ -258,7 +258,7 @@
|
||||
'idx': 3,
|
||||
'in_filter': 1,
|
||||
'label': 'Raised By (Email)',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04805',
|
||||
'no_column': None,
|
||||
@ -294,7 +294,7 @@
|
||||
'idx': 4,
|
||||
'in_filter': None,
|
||||
'label': 'Description',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04806',
|
||||
'no_column': None,
|
||||
@ -330,7 +330,7 @@
|
||||
'idx': 5,
|
||||
'in_filter': None,
|
||||
'label': 'Problem Description',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05248',
|
||||
'no_column': None,
|
||||
@ -353,7 +353,7 @@
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-24 11:54:03',
|
||||
'creation': '2011-06-29 17:28:05',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'description': None,
|
||||
@ -366,9 +366,9 @@
|
||||
'idx': 6,
|
||||
'in_filter': None,
|
||||
'label': 'Thread HTML',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05356',
|
||||
'name': 'FL05360',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
@ -402,7 +402,7 @@
|
||||
'idx': 7,
|
||||
'in_filter': None,
|
||||
'label': 'New Response',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04808',
|
||||
'no_column': None,
|
||||
@ -438,7 +438,7 @@
|
||||
'idx': 8,
|
||||
'in_filter': None,
|
||||
'label': 'Send',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04809',
|
||||
'no_column': None,
|
||||
@ -461,7 +461,7 @@
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-06-24 11:54:03',
|
||||
'creation': '2011-06-29 17:28:05',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
@ -474,9 +474,9 @@
|
||||
'idx': 9,
|
||||
'in_filter': None,
|
||||
'label': 'Additional Info',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05357',
|
||||
'name': 'FL05361',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
@ -497,7 +497,7 @@
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-24 11:54:03',
|
||||
'creation': '2011-06-29 17:28:05',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'description': None,
|
||||
@ -510,9 +510,9 @@
|
||||
'idx': 10,
|
||||
'in_filter': None,
|
||||
'label': None,
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05358',
|
||||
'name': 'FL05362',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
@ -546,7 +546,7 @@
|
||||
'idx': 11,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04812',
|
||||
'no_column': None,
|
||||
@ -582,7 +582,7 @@
|
||||
'idx': 12,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer Name',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04813',
|
||||
'no_column': None,
|
||||
@ -605,7 +605,7 @@
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-24 12:20:56',
|
||||
'creation': '2011-06-29 17:28:04',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
@ -618,9 +618,9 @@
|
||||
'idx': 13,
|
||||
'in_filter': None,
|
||||
'label': 'Address',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05399',
|
||||
'name': 'FL05355',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
@ -641,7 +641,7 @@
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-24 12:20:56',
|
||||
'creation': '2011-06-29 17:28:04',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
@ -654,9 +654,9 @@
|
||||
'idx': 14,
|
||||
'in_filter': None,
|
||||
'label': 'Contact Name',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05401',
|
||||
'name': 'FL05356',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
@ -677,7 +677,7 @@
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-24 12:20:56',
|
||||
'creation': '2011-06-29 17:28:05',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
@ -690,9 +690,9 @@
|
||||
'idx': 15,
|
||||
'in_filter': None,
|
||||
'label': 'Mobile No',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05400',
|
||||
'name': 'FL05357',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
@ -713,7 +713,7 @@
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-05-23 10:18:58',
|
||||
'creation': '2011-06-29 17:28:05',
|
||||
'default': None,
|
||||
'depends_on': None,
|
||||
'description': None,
|
||||
@ -726,9 +726,9 @@
|
||||
'idx': 16,
|
||||
'in_filter': None,
|
||||
'label': 'Contact Email',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04814',
|
||||
'name': 'FL05358',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': 'contact_no',
|
||||
@ -762,7 +762,7 @@
|
||||
'idx': 17,
|
||||
'in_filter': None,
|
||||
'label': 'Opening Date',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04815',
|
||||
'no_column': None,
|
||||
@ -798,7 +798,7 @@
|
||||
'idx': 18,
|
||||
'in_filter': None,
|
||||
'label': 'Opening Time',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04816',
|
||||
'no_column': None,
|
||||
@ -821,7 +821,7 @@
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'creation': '2011-06-24 11:54:03',
|
||||
'creation': '2011-06-29 17:28:05',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'description': None,
|
||||
@ -834,9 +834,9 @@
|
||||
'idx': 19,
|
||||
'in_filter': None,
|
||||
'label': None,
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05359',
|
||||
'name': 'FL05363',
|
||||
'no_column': None,
|
||||
'no_copy': None,
|
||||
'oldfieldname': None,
|
||||
@ -856,7 +856,7 @@
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-23 10:18:58',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
@ -870,7 +870,7 @@
|
||||
'idx': 20,
|
||||
'in_filter': 1,
|
||||
'label': 'Allocated To',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04818',
|
||||
'no_column': None,
|
||||
@ -900,13 +900,13 @@
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'resolution_details',
|
||||
'fieldtype': 'Text',
|
||||
'fieldtype': 'Small Text',
|
||||
'hidden': None,
|
||||
'icon': None,
|
||||
'idx': 21,
|
||||
'in_filter': None,
|
||||
'label': 'Resolution Details',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04819',
|
||||
'no_column': None,
|
||||
@ -928,7 +928,7 @@
|
||||
},
|
||||
{
|
||||
'allow_on_submit': None,
|
||||
'colour': None,
|
||||
'colour': 'White:FFF',
|
||||
'creation': '2011-05-23 10:18:58',
|
||||
'default': None,
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
@ -942,7 +942,7 @@
|
||||
'idx': 22,
|
||||
'in_filter': 0,
|
||||
'label': 'Resolution Date',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04820',
|
||||
'no_column': None,
|
||||
@ -978,7 +978,7 @@
|
||||
'idx': 23,
|
||||
'in_filter': None,
|
||||
'label': 'Resolution Time',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL04821',
|
||||
'no_column': None,
|
||||
@ -1014,7 +1014,7 @@
|
||||
'idx': 24,
|
||||
'in_filter': None,
|
||||
'label': 'Content Type',
|
||||
'modified': '2011-06-27 11:30:33',
|
||||
'modified': '2011-07-04 15:13:48',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'FL05251',
|
||||
'no_column': None,
|
||||
|
Loading…
Reference in New Issue
Block a user