brotherton-erpnext/erpnext/startup/event_handlers.py
2014-03-11 16:15:59 +05:30

22 lines
744 B
Python

# 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 frappe
from erpnext.home import make_feed
def on_session_creation(login_manager):
"""
called after login
update login_from and delete parallel sessions
"""
if frappe.session['user'] not in ('Guest'):
# create feed
from frappe.utils import nowtime
from frappe.utils.user import get_user_fullname
frappe.db.begin()
make_feed('Login', 'User', login_manager.user, login_manager.user,
'%s logged in at %s' % (get_user_fullname(login_manager.user), nowtime()),
login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D')
frappe.db.commit()