Merge branch 'hotfix'
This commit is contained in:
commit
1b59b624c3
@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
__version__ = '7.2.20'
|
__version__ = '7.2.21'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
## temp utility
|
## temp utility
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
from erpnext.utilities.activation import get_level
|
||||||
|
|
||||||
def update_doctypes():
|
def update_doctypes():
|
||||||
for d in frappe.db.sql("""select df.parent, df.fieldname
|
for d in frappe.db.sql("""select df.parent, df.fieldname
|
||||||
@ -29,5 +30,6 @@ def get_site_info(site_info):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'company': company,
|
'company': company,
|
||||||
'domain': domain
|
'domain': domain,
|
||||||
|
'activation': get_level()
|
||||||
}
|
}
|
||||||
|
36
erpnext/utilities/activation.py
Normal file
36
erpnext/utilities/activation.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
def get_level():
|
||||||
|
activation_level = 0
|
||||||
|
if frappe.db.get_single_value('System Settings', 'setup_complete'):
|
||||||
|
activation_level = 1
|
||||||
|
|
||||||
|
if frappe.db.count('Item') > 5:
|
||||||
|
activation_level += 1
|
||||||
|
|
||||||
|
if frappe.db.count('Customer') > 5:
|
||||||
|
activation_level += 1
|
||||||
|
|
||||||
|
if frappe.db.count('Sales Order') > 2:
|
||||||
|
activation_level += 1
|
||||||
|
|
||||||
|
if frappe.db.count('Purchase Order') > 2:
|
||||||
|
activation_level += 1
|
||||||
|
|
||||||
|
if frappe.db.count('Employee') > 3:
|
||||||
|
activation_level += 1
|
||||||
|
|
||||||
|
if frappe.db.count('Payment Entry') > 2:
|
||||||
|
activation_level += 1
|
||||||
|
|
||||||
|
if frappe.db.count('Communication', dict(communication_medium='Email')) > 10:
|
||||||
|
activation_level += 1
|
||||||
|
|
||||||
|
if frappe.db.count('User') > 5:
|
||||||
|
activation_level += 1
|
||||||
|
|
||||||
|
# recent login
|
||||||
|
if frappe.db.sql('select name from tabUser where last_login > date_sub(now(), interval 2 day) limit 1'):
|
||||||
|
activation_level += 1
|
||||||
|
|
||||||
|
return activation_level
|
Loading…
Reference in New Issue
Block a user