support ticket updates

This commit is contained in:
Ravi Dey
2011-07-04 16:23:19 +05:30
parent 627d01bd4b
commit 3333ca1721
5 changed files with 142 additions and 59 deletions

View File

@@ -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)