From 6dd461fec480f17e148fb4254b5aa35fc187ee98 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 16 Feb 2017 14:51:48 +0530 Subject: [PATCH 1/2] [add] site activation level --- erpnext/utilities/__init__.py | 4 +++- erpnext/utilities/activation.py | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 erpnext/utilities/activation.py diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py index bba21e6f11..b94061c29c 100644 --- a/erpnext/utilities/__init__.py +++ b/erpnext/utilities/__init__.py @@ -1,6 +1,7 @@ ## temp utility import frappe +from erpnext.utilities.activation import get_level def update_doctypes(): for d in frappe.db.sql("""select df.parent, df.fieldname @@ -29,5 +30,6 @@ def get_site_info(site_info): return { 'company': company, - 'domain': domain + 'domain': domain, + 'activation': get_level() } diff --git a/erpnext/utilities/activation.py b/erpnext/utilities/activation.py new file mode 100644 index 0000000000..563f71ea2b --- /dev/null +++ b/erpnext/utilities/activation.py @@ -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 \ No newline at end of file From a7d6b68bc011467a49c8b6050c805a941f2131b6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 16 Feb 2017 16:29:58 +0600 Subject: [PATCH 2/2] bumped to version 7.2.21 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7ec8430f54..4f53d0daba 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.2.20' +__version__ = '7.2.21' def get_default_company(user=None): '''Get default company for user'''