notifications via hooks webnotes/wnframework#351
This commit is contained in:
parent
6de403f2be
commit
30430796c7
@ -1,10 +1,14 @@
|
||||
app_name ERPNext
|
||||
app_name ERPNext
|
||||
|
||||
app_include_js assets/js/erpnext.min.js
|
||||
app_include_css assets/css/erpnext.css
|
||||
get_desktop_icons erpnext.manage.get_desktop_icons
|
||||
boot_session erpnext.startup.boot.boot_session
|
||||
app_include_js assets/js/erpnext.min.js
|
||||
app_include_css assets/css/erpnext.css
|
||||
get_desktop_icons erpnext.manage.get_desktop_icons
|
||||
boot_session erpnext.startup.boot.boot_session
|
||||
notification_config erpnext.startup.notifications.get_notification_config
|
||||
|
||||
standard_queries Warehouse erpnext.stock.utils.get_warehouse_list
|
||||
standard_queries Customer erpnext.selling.utils.get_customer_list
|
||||
dump_report_map erpnext.startup.report_data_map.data_map
|
||||
|
||||
standard_queries Warehouse:erpnext.stock.utils.get_warehouse_list
|
||||
standard_queries Customer:erpnext.selling.utils.get_customer_list
|
||||
|
||||
mail_footer erpnext.startup.mail_footer
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from home import update_feed
|
||||
from erpnext.home import update_feed
|
||||
from webnotes.core.doctype.notification_count.notification_count import clear_doctype_notifications
|
||||
from erpnext.stock.doctype.material_request.material_request import update_completed_qty
|
||||
|
||||
|
35
erpnext/startup/notifications.py
Normal file
35
erpnext/startup/notifications.py
Normal file
@ -0,0 +1,35 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_notification_config():
|
||||
return { "for_doctype":
|
||||
{
|
||||
"Support Ticket": {"status":"Open"},
|
||||
"Customer Issue": {"status":"Open"},
|
||||
"Task": {"status":"Open"},
|
||||
"Lead": {"status":"Open"},
|
||||
"Contact": {"status":"Open"},
|
||||
"Opportunity": {"docstatus":0},
|
||||
"Quotation": {"docstatus":0},
|
||||
"Sales Order": {"docstatus":0},
|
||||
"Journal Voucher": {"docstatus":0},
|
||||
"Sales Invoice": {"docstatus":0},
|
||||
"Purchase Invoice": {"docstatus":0},
|
||||
"Leave Application": {"status":"Open"},
|
||||
"Expense Claim": {"approval_status":"Draft"},
|
||||
"Job Applicant": {"status":"Open"},
|
||||
"Purchase Receipt": {"docstatus":0},
|
||||
"Delivery Note": {"docstatus":0},
|
||||
"Stock Entry": {"docstatus":0},
|
||||
"Material Request": {"docstatus":0},
|
||||
"Purchase Order": {"docstatus":0},
|
||||
"Production Order": {"docstatus":0},
|
||||
"BOM": {"docstatus":0},
|
||||
"Timesheet": {"docstatus":0},
|
||||
"Time Log": {"status":"Draft"},
|
||||
"Time Log Batch": {"status":"Draft"},
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
for_doctype = {
|
||||
"Support Ticket": {"status":"Open"},
|
||||
"Customer Issue": {"status":"Open"},
|
||||
"Task": {"status":"Open"},
|
||||
"Lead": {"status":"Open"},
|
||||
"Contact": {"status":"Open"},
|
||||
"Opportunity": {"docstatus":0},
|
||||
"Quotation": {"docstatus":0},
|
||||
"Sales Order": {"docstatus":0},
|
||||
"Journal Voucher": {"docstatus":0},
|
||||
"Sales Invoice": {"docstatus":0},
|
||||
"Purchase Invoice": {"docstatus":0},
|
||||
"Leave Application": {"status":"Open"},
|
||||
"Expense Claim": {"approval_status":"Draft"},
|
||||
"Job Applicant": {"status":"Open"},
|
||||
"Purchase Receipt": {"docstatus":0},
|
||||
"Delivery Note": {"docstatus":0},
|
||||
"Stock Entry": {"docstatus":0},
|
||||
"Material Request": {"docstatus":0},
|
||||
"Purchase Order": {"docstatus":0},
|
||||
"Production Order": {"docstatus":0},
|
||||
"BOM": {"docstatus":0},
|
||||
"Timesheet": {"docstatus":0},
|
||||
"Time Log": {"status":"Draft"},
|
||||
"Time Log Batch": {"status":"Draft"},
|
||||
}
|
||||
|
||||
def get_things_todo():
|
||||
"""Returns a count of incomplete todos"""
|
||||
incomplete_todos = webnotes.conn.sql("""\
|
||||
SELECT COUNT(*) FROM `tabToDo`
|
||||
WHERE IFNULL(checked, 0) = 0
|
||||
AND (owner = %s or assigned_by=%s)""", (webnotes.session.user, webnotes.session.user))
|
||||
return incomplete_todos[0][0]
|
||||
|
||||
def get_todays_events():
|
||||
"""Returns a count of todays events in calendar"""
|
||||
from webnotes.core.doctype.event.event import get_events
|
||||
from webnotes.utils import nowdate
|
||||
today = nowdate()
|
||||
return len(get_events(today, today))
|
||||
|
||||
def get_unread_messages():
|
||||
"returns unread (docstatus-0 messages for a user)"
|
||||
return webnotes.conn.sql("""\
|
||||
SELECT count(*)
|
||||
FROM `tabComment`
|
||||
WHERE comment_doctype IN ('My Company', 'Message')
|
||||
AND comment_docname = %s
|
||||
AND ifnull(docstatus,0)=0
|
||||
""", webnotes.user.name)[0][0]
|
||||
|
||||
for_module_doctypes = {
|
||||
"ToDo": "To Do",
|
||||
"Event": "Calendar",
|
||||
"Comment": "Messages"
|
||||
}
|
||||
|
||||
for_module = {
|
||||
"To Do": get_things_todo,
|
||||
"Calendar": get_todays_events,
|
||||
"Messages": get_unread_messages
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user