Merge branch 'master' of github.com:webnotes/erpnext into unicode

Conflicts:
	erpnext/stock/doctype/item/item.txt
This commit is contained in:
Anand Doshi
2012-08-07 15:07:56 +05:30
24 changed files with 330 additions and 55 deletions

View File

@@ -136,6 +136,7 @@ erpnext.update_messages = function(reset) {
show_in_circle('things_todo', r.message.things_todo);
show_in_circle('todays_events', r.message.todays_events);
show_in_circle('open_tasks', r.message.open_tasks);
show_in_circle('unanswered_questions', r.message.unanswered_questions);
} else {
clearInterval(wn.updates.id);

View File

@@ -12,9 +12,7 @@ def get_unread_messages():
""", webnotes.user.name, as_list=1)
def get_open_support_tickets():
"""
Returns a count of open support tickets
"""
"""Returns a count of open support tickets"""
from webnotes.utils import cint
open_support_tickets = webnotes.conn.sql("""\
SELECT COUNT(*) FROM `tabSupport Ticket`
@@ -22,18 +20,14 @@ def get_open_support_tickets():
return open_support_tickets and cint(open_support_tickets[0][0]) or 0
def get_open_tasks():
"""
Returns a count of open tasks
"""
"""Returns a count of open tasks"""
from webnotes.utils import cint
return webnotes.conn.sql("""\
SELECT COUNT(*) FROM `tabTask`
WHERE status = 'Open'""")[0][0]
def get_things_todo():
"""
Returns a count of incomplete todos
"""
"""Returns a count of incomplete todos"""
from webnotes.utils import cint
incomplete_todos = webnotes.conn.sql("""\
SELECT COUNT(*) FROM `tabToDo`
@@ -42,9 +36,7 @@ def get_things_todo():
return incomplete_todos and cint(incomplete_todos[0][0]) or 0
def get_todays_events():
"""
Returns a count of todays events in calendar
"""
"""Returns a count of todays events in calendar"""
from webnotes.utils import nowdate, cint
todays_events = webnotes.conn.sql("""\
SELECT COUNT(*) FROM `tabEvent`
@@ -54,6 +46,11 @@ def get_todays_events():
webnotes.session.get('user'), nowdate()))
return todays_events and cint(todays_events[0][0]) or 0
def get_unanswered_questions():
return len(filter(lambda d: d[0]==0,
webnotes.conn.sql("""select (select count(*) from tabAnswer
where tabAnswer.question = tabQuestion.name) as answers from tabQuestion""")))
@webnotes.whitelist()
def get_global_status_messages(arg=None):
return {
@@ -61,5 +58,6 @@ def get_global_status_messages(arg=None):
'open_support_tickets': get_open_support_tickets(),
'things_todo': get_things_todo(),
'todays_events': get_todays_events(),
'open_tasks': get_open_tasks()
'open_tasks': get_open_tasks(),
'unanswered_questions': get_unanswered_questions()
}