blob: 563f71ea2b4be904d15266e266465ab17837733b [file] [log] [blame]
Rushabh Mehta6dd461f2017-02-16 14:51:48 +05301import frappe
2
3def get_level():
4 activation_level = 0
5 if frappe.db.get_single_value('System Settings', 'setup_complete'):
6 activation_level = 1
7
8 if frappe.db.count('Item') > 5:
9 activation_level += 1
10
11 if frappe.db.count('Customer') > 5:
12 activation_level += 1
13
14 if frappe.db.count('Sales Order') > 2:
15 activation_level += 1
16
17 if frappe.db.count('Purchase Order') > 2:
18 activation_level += 1
19
20 if frappe.db.count('Employee') > 3:
21 activation_level += 1
22
23 if frappe.db.count('Payment Entry') > 2:
24 activation_level += 1
25
26 if frappe.db.count('Communication', dict(communication_medium='Email')) > 10:
27 activation_level += 1
28
29 if frappe.db.count('User') > 5:
30 activation_level += 1
31
32 # recent login
33 if frappe.db.sql('select name from tabUser where last_login > date_sub(now(), interval 2 day) limit 1'):
34 activation_level += 1
35
36 return activation_level