Example #1
0
def get_notification_info_for_boot():
	out = get()
		
	can_read = webnotes.user.get_can_read()
	conditions = {}
	module_doctypes = {}
	doctype_info = dict(webnotes.conn.sql("""select name, module from tabDocType"""))

	try:
		from startup.open_count import for_doctype
	except ImportError:
		for_doctype = {}
	
	for d in list(set(can_read + for_doctype.keys())):
		if d in for_doctype:
			conditions[d] = for_doctype[d]
		
		if d in doctype_info:
			module_doctypes.setdefault(doctype_info[d], []).append(d)
	
	out.update({
		"conditions": conditions,
		"module_doctypes": module_doctypes,
	})
	
	return out
Example #2
0
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt

# For license information, please see license.txt

from __future__ import unicode_literals
import webnotes
try:
	from startup.open_count import for_doctype, for_module, for_module_doctypes
	all_doctypes = for_doctype.keys() + for_module_doctypes.keys()
except ImportError:
	for_doctype = {}
	for_module = {}
	for_module_doctypes = []
	all_doctypes = []

class DocType:
	def __init__(self, d, dl):
		self.doc, self.doclist = d, dl

@webnotes.whitelist()
def get():
	can_read = webnotes.user.get_can_read()
	open_count_doctype = {}
	open_count_module = {}

	notification_count = dict(webnotes.conn.sql("""select for_doctype, open_count 
		from `tabNotification Count` where owner=%s""", webnotes.session.user))

	for d in for_doctype:
		if d in can_read: