[minor] add progress in desktop help message

This commit is contained in:
Rushabh Mehta 2017-03-02 11:13:18 +05:30
parent 093eba2336
commit e7900b24a0

View File

@ -51,87 +51,101 @@ def get_level():
def get_help_messages(): def get_help_messages():
'''Returns help messages to be shown on Desktop''' '''Returns help messages to be shown on Desktop'''
if get_level() > 6: # if get_level() > 6:
return [] # return []
messages = [] messages = []
domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain') domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
if domain in ('Manufacturing', 'Retail', 'Services', 'Distribution'): message_settings = [
count = frappe.db.count('Lead') frappe._dict(
if count < 3: doctype='Lead',
messages.append(dict(
title=_('Create Leads'), title=_('Create Leads'),
description=_('Leads help you get business, add all your contacts and more as your leads'), description=_('Leads help you get business, add all your contacts and more as your leads'),
action=_('Make Lead'), action=_('Make Lead'),
route='List/Lead', route='List/Lead',
count=count domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
)) target=3
),
count = frappe.db.count('Quotation') frappe._dict(
if count < 3: doctype='Quotation',
messages.append(dict(
title=_('Create customer quotes'), title=_('Create customer quotes'),
description=_('Quotations are proposals, bids you have sent to your customers'), description=_('Quotations are proposals, bids you have sent to your customers'),
action=_('Make Quotation'), action=_('Make Quotation'),
route='List/Quotation' route='List/Quotation',
)) domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
target=30
count = frappe.db.count('Sales Order') ),
if count < 3: frappe._dict(
messages.append(dict( doctype='Sales Order',
title=_('Manage your orders'), title=_('Manage your orders'),
description=_('Make Sales Orders to help you plan your work and deliver on-time'), description=_('Make Sales Orders to help you plan your work and deliver on-time'),
action=_('Make Sales Order'), action=_('Make Sales Order'),
route='List/Sales Order' route='List/Sales Order',
)) domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
target=3
count = frappe.db.count('Purchase Order') ),
if count < 3: frappe._dict(
messages.append(dict( doctype='Purchase Order',
title=_('Create Purchase Orders'), title=_('Create Purchase Orders'),
description=_('Purchase orders help you plan and follow up on your purchases'), description=_('Purchase orders help you plan and follow up on your purchases'),
action=_('Make Purchase Order'), action=_('Make Purchase Order'),
route='List/Purchase Order' route='List/Purchase Order',
)) domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
target=3
count = frappe.db.count('User') ),
if count < 3: frappe._dict(
messages.append(dict( doctype='User',
title=_('Create Users'), title=_('Create Users'),
description=_('Add the rest of your organization as your users. You can also add invite Customers to your portal by adding them from Contacts'), description=_('Add the rest of your organization as your users. You can also add invite Customers to your portal by adding them from Contacts'),
action=_('Make User'), action=_('Make User'),
route='List/User' route='List/User',
)) domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
target=3
elif domain == 'Education': ),
count = frappe.db.count('Student') frappe._dict(
if count < 5: doctype='Timesheet',
messages.append(dict( title=_('Add Timesheets'),
description=_('Timesheets help keep track of time, cost and billing for activites done by your team'),
action=_('Make Timesheet'),
route='List/Timesheet',
domain=('Services',),
target=5
),
frappe._dict(
doctype='Student',
title=_('Add Students'), title=_('Add Students'),
description=_('Students are at the heart of the system, add all your students'), description=_('Students are at the heart of the system, add all your students'),
action=_('Make Student'), action=_('Make Student'),
route='List/Student' route='List/Student',
)) domain=('Education',),
target=5
count = frappe.db.count('Student Batch') ),
if count < 3: frappe._dict(
messages.append(dict( doctype='Student Batch',
title=_('Group your students in batches'), title=_('Group your students in batches'),
description=_('Student Batches help you track attendance, assessments and fees for students'), description=_('Student Batches help you track attendance, assessments and fees for students'),
action=_('Make Student Batch'), action=_('Make Student Batch'),
route='List/Student Batch' route='List/Student Batch',
)) domain=('Education',),
target=3
# anyways ),
count = frappe.db.count('Employee') frappe._dict(
if count < 3: doctype='Employee',
messages.append(dict(
title=_('Create Employee Records'), title=_('Create Employee Records'),
description=_('Create Employee records to manage leaves, expense claims and payroll'), description=_('Create Employee records to manage leaves, expense claims and payroll'),
action=_('Make Employee'), action=_('Make Employee'),
route='List/Employee' route='List/Employee',
)) target=3
)
]
for m in message_settings:
if not m.domain or domain in m.domain:
m.count = frappe.db.count(m.doctype)
if m.count < m.target:
messages.append(m)
return messages return messages