|
|
|
@@ -20,36 +20,36 @@ from frappe import msgprint
|
|
|
|
|
|
|
|
|
|
|
|
feed_dict = {
|
|
|
|
feed_dict = {
|
|
|
|
# Project
|
|
|
|
# Project
|
|
|
|
'Project': ['[%(status)s]', '#000080'],
|
|
|
|
'Project': ['[%(status)s]', '#000080'],
|
|
|
|
'Task': ['[%(status)s] %(subject)s', '#000080'],
|
|
|
|
'Task': ['[%(status)s] %(subject)s', '#000080'],
|
|
|
|
|
|
|
|
|
|
|
|
# Sales
|
|
|
|
# Sales
|
|
|
|
'Lead': ['%(lead_name)s', '#000080'],
|
|
|
|
'Lead': ['%(lead_name)s', '#000080'],
|
|
|
|
'Quotation': ['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
|
|
|
|
'Quotation': ['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
|
|
|
|
'Sales Order': ['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
|
|
|
|
'Sales Order': ['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
|
|
|
|
|
|
|
|
|
|
|
|
# Purchase
|
|
|
|
# Purchase
|
|
|
|
'Supplier': ['%(supplier_name)s, %(supplier_type)s', '#6495ED'],
|
|
|
|
'Supplier': ['%(supplier_name)s, %(supplier_type)s', '#6495ED'],
|
|
|
|
'Purchase Order': ['[%(status)s] %(name)s To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
|
|
|
|
'Purchase Order': ['[%(status)s] %(name)s To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
|
|
|
|
|
|
|
|
|
|
|
|
# Stock
|
|
|
|
# Stock
|
|
|
|
'Delivery Note': ['[%(status)s] To %(customer_name)s', '#4169E1'],
|
|
|
|
'Delivery Note': ['[%(status)s] To %(customer_name)s', '#4169E1'],
|
|
|
|
'Purchase Receipt': ['[%(status)s] From %(supplier)s', '#4169E1'],
|
|
|
|
'Purchase Receipt': ['[%(status)s] From %(supplier)s', '#4169E1'],
|
|
|
|
|
|
|
|
|
|
|
|
# Accounts
|
|
|
|
# Accounts
|
|
|
|
'Journal Voucher': ['[%(voucher_type)s] %(name)s', '#4169E1'],
|
|
|
|
'Journal Voucher': ['[%(voucher_type)s] %(name)s', '#4169E1'],
|
|
|
|
'Purchase Invoice': ['To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
|
|
|
|
'Purchase Invoice': ['To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
|
|
|
|
'Sales Invoice':['To %(customer_name)s for %(currency)s %(grand_total_export)s', '#4169E1'],
|
|
|
|
'Sales Invoice': ['To %(customer_name)s for %(currency)s %(grand_total_export)s', '#4169E1'],
|
|
|
|
|
|
|
|
|
|
|
|
# HR
|
|
|
|
# HR
|
|
|
|
'Expense Claim': ['[%(approval_status)s] %(name)s by %(employee_name)s', '#4169E1'],
|
|
|
|
'Expense Claim': ['[%(approval_status)s] %(name)s by %(employee_name)s', '#4169E1'],
|
|
|
|
'Salary Slip': ['%(employee_name)s for %(month)s %(fiscal_year)s', '#4169E1'],
|
|
|
|
'Salary Slip': ['%(employee_name)s for %(month)s %(fiscal_year)s', '#4169E1'],
|
|
|
|
'Leave Transaction':['%(leave_type)s for %(employee)s', '#4169E1'],
|
|
|
|
'Leave Transaction': ['%(leave_type)s for %(employee)s', '#4169E1'],
|
|
|
|
|
|
|
|
|
|
|
|
# Support
|
|
|
|
# Support
|
|
|
|
'Customer Issue': ['[%(status)s] %(description)s by %(customer_name)s', '#000080'],
|
|
|
|
'Customer Issue': ['[%(status)s] %(description)s by %(customer_name)s', '#000080'],
|
|
|
|
'Maintenance Visit':['To %(customer_name)s', '#4169E1'],
|
|
|
|
'Maintenance Visit': ['To %(customer_name)s', '#4169E1'],
|
|
|
|
'Support Ticket': ["[%(status)s] %(subject)s", '#000080'],
|
|
|
|
'Support Ticket': ["[%(status)s] %(subject)s", '#000080'],
|
|
|
|
|
|
|
|
|
|
|
|
# Website
|
|
|
|
# Website
|
|
|
|
'Web Page': ['%(title)s', '#000080'],
|
|
|
|
'Web Page': ['%(title)s', '#000080'],
|
|
|
|
@@ -59,7 +59,7 @@ feed_dict = {
|
|
|
|
def make_feed(feedtype, doctype, name, owner, subject, color):
|
|
|
|
def make_feed(feedtype, doctype, name, owner, subject, color):
|
|
|
|
"makes a new Feed record"
|
|
|
|
"makes a new Feed record"
|
|
|
|
#msgprint(subject)
|
|
|
|
#msgprint(subject)
|
|
|
|
from frappe.utils import get_fullname
|
|
|
|
from frappe.utils import get_fullname
|
|
|
|
|
|
|
|
|
|
|
|
if feedtype in ('Login', 'Comment', 'Assignment'):
|
|
|
|
if feedtype in ('Login', 'Comment', 'Assignment'):
|
|
|
|
# delete old login, comment feed
|
|
|
|
# delete old login, comment feed
|
|
|
|
@@ -71,7 +71,7 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
|
|
|
|
where doc_type=%s and doc_name=%s
|
|
|
|
where doc_type=%s and doc_name=%s
|
|
|
|
and ifnull(feed_type,'') != 'Comment'""", (doctype, name))
|
|
|
|
and ifnull(feed_type,'') != 'Comment'""", (doctype, name))
|
|
|
|
|
|
|
|
|
|
|
|
f = frappe.get_doc('Feed')
|
|
|
|
f = frappe.new_doc('Feed')
|
|
|
|
f.owner = owner
|
|
|
|
f.owner = owner
|
|
|
|
f.feed_type = feedtype
|
|
|
|
f.feed_type = feedtype
|
|
|
|
f.doc_type = doctype
|
|
|
|
f.doc_type = doctype
|
|
|
|
@@ -81,16 +81,15 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
|
|
|
|
f.full_name = get_fullname(owner)
|
|
|
|
f.full_name = get_fullname(owner)
|
|
|
|
f.save()
|
|
|
|
f.save()
|
|
|
|
|
|
|
|
|
|
|
|
def update_feed(bean, method=None):
|
|
|
|
def update_feed(doc, method=None):
|
|
|
|
"adds a new feed"
|
|
|
|
"adds a new feed"
|
|
|
|
doc = bean.doc
|
|
|
|
|
|
|
|
if method in ['on_update', 'on_submit']:
|
|
|
|
if method in ['on_update', 'on_submit']:
|
|
|
|
subject, color = feed_dict.get(doc.doctype, [None, None])
|
|
|
|
subject, color = feed_dict.get(doc.doctype, [None, None])
|
|
|
|
if subject:
|
|
|
|
if subject:
|
|
|
|
make_feed('', doc.doctype, doc.name, doc.owner, subject % doc.fields, color)
|
|
|
|
make_feed('', doc.doctype, doc.name, doc.owner, subject % doc.fields, color)
|
|
|
|
|
|
|
|
|
|
|
|
def make_comment_feed(bean, method):
|
|
|
|
def make_comment_feed(doc, method):
|
|
|
|
"""add comment to feed"""
|
|
|
|
"""add comment to feed"""
|
|
|
|
doc = bean.doc
|
|
|
|
|
|
|
|
make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by,
|
|
|
|
make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by,
|
|
|
|
'<i>"' + doc.comment + '"</i>', '#6B24B3')
|
|
|
|
'<i>"' + doc.comment + '"</i>', '#6B24B3')
|
|
|
|
|
|
|
|
|
|
|
|
|