mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
added setup wizard 0.1
This commit is contained in:
@@ -35,11 +35,51 @@ def get_status_details(arg=None):
|
||||
if msg_id and msg_id != webnotes.conn.get_global('system_message_id', webnotes.session['user']):
|
||||
msg = webnotes.conn.get_global('system_message')
|
||||
|
||||
return {
|
||||
ret = {
|
||||
'user_count': len(online) or 0,
|
||||
'unread_messages': get_unread_messages(),
|
||||
'online_users': online or [],
|
||||
'system_message':msg,
|
||||
'is_trial': webnotes.conn.get_global('is_trial'),
|
||||
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0')
|
||||
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0'),
|
||||
'setup_status': get_setup_status()
|
||||
}
|
||||
return ret
|
||||
|
||||
def get_setup_status():
|
||||
"""
|
||||
Returns the setup status of the current account
|
||||
"""
|
||||
if cint(webnotes.conn.get_global('setup_done')):
|
||||
return ''
|
||||
|
||||
percent = 20
|
||||
ret = []
|
||||
|
||||
if not webnotes.conn.get_value('Personalize', None, 'header_html'):
|
||||
ret.append('<a href="#!Form/Personalize/Personalize">Upload your company banner</a>')
|
||||
else:
|
||||
percent += 20
|
||||
|
||||
def check_type(doctype, ret, percent):
|
||||
if not webnotes.conn.sql("select count(*) from tab%s" % doctype)[0][0]:
|
||||
ret.append('''
|
||||
<a href="#!Form/%(dt)s/New">
|
||||
Create a new %(dt)s
|
||||
</a> or
|
||||
<a href="#!Import Data/%(dt)s">
|
||||
Import from a spreadsheet</a>''' % {'dt':doctype})
|
||||
else:
|
||||
percent += 20
|
||||
return ret, percent
|
||||
|
||||
ret, percent = check_type('Item', ret, percent)
|
||||
ret, percent = check_type('Customer', ret, percent)
|
||||
ret, percent = check_type('Supplier', ret, percent)
|
||||
|
||||
if percent==100:
|
||||
webnotes.conn.set_global('setup_done', '1')
|
||||
return ''
|
||||
|
||||
return {'ret': ret, 'percent': percent}
|
||||
|
||||
Reference in New Issue
Block a user