Merge pull request #7893 from pratu16x7/crm-docs
CRM docs update
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index d284c05..c080f44 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
-__version__ = '7.2.26'
+__version__ = '7.2.27'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index 4c1d443..400b076 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -14,6 +14,7 @@
setup_holiday_list()
setup_user()
setup_employee()
+ setup_user_roles()
employees = frappe.get_all('Employee', fields=['name', 'date_of_joining'])
@@ -24,7 +25,6 @@
setup_salary_structure(employees[5:], 1)
setup_leave_allocation()
- setup_user_roles()
setup_customer()
setup_supplier()
setup_warehouse()
@@ -135,6 +135,7 @@
for e in employees:
ss.append('employees', {
'employee': e.name,
+ 'from_date': "2015-01-01",
'base': random.random() * 10000
})
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.json b/erpnext/hr/doctype/salary_slip/salary_slip.json
index 03628e8..8f1e6b3 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.json
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.json
@@ -272,7 +272,7 @@
"label": "Status",
"length": 0,
"no_copy": 0,
- "options": "Draft\nSubmitted\nPaid\nCancelled",
+ "options": "Draft\nSubmitted\nCancelled",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -1581,7 +1581,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-02-22 06:11:01.882797",
+ "modified": "2017-03-02 02:25:53.844701",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Slip",
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 6ff6f36..15d5df8 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -389,8 +389,6 @@
status = "Draft"
elif self.docstatus == 1:
status = "Submitted"
- if self.journal_entry:
- status = "Paid"
elif self.docstatus == 2:
status = "Cancelled"
return status
@@ -401,5 +399,4 @@
if linked_ss:
for ss in linked_ss:
ss_doc = frappe.get_doc("Salary Slip", ss)
- frappe.db.set_value("Salary Slip", ss_doc.name, "status", "Submitted")
frappe.db.set_value("Salary Slip", ss_doc.name, "journal_entry", "")
diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json
index dbdffdf..e809328 100644
--- a/erpnext/projects/doctype/project/project.json
+++ b/erpnext/projects/doctype/project/project.json
@@ -1027,6 +1027,35 @@
{
"allow_on_submit": 0,
"bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "total_sales_cost",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Total Sales Cost (via Sales Order)",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
"collapsible": 1,
"columns": 0,
"fieldname": "margin",
@@ -1232,4 +1261,4 @@
"timeline_field": "customer",
"track_changes": 0,
"track_seen": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index b5ef4bf..289b7dd 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -176,6 +176,13 @@
from `tabPurchase Invoice Item` where project = %s and docstatus=1""", self.name)
self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
+
+ def update_sales_costing(self):
+ total_sales_cost = frappe.db.sql("""select sum(grand_total)
+ from `tabSales Order` where project = %s and docstatus=1""", self.name)
+
+ self.total_sales_cost = total_sales_cost and total_sales_cost[0][0] or 0
+
def send_welcome_email(self):
url = get_url("/project/?name={0}".format(self.name))
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index fdaadd8..7c5fb04 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -157,7 +157,7 @@
self.update_reserved_qty()
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)
-
+ self.update_project()
self.update_prevdoc_status('submit')
def on_cancel(self):
@@ -167,10 +167,19 @@
self.check_nextdoc_docstatus()
self.update_reserved_qty()
-
+ self.update_project()
self.update_prevdoc_status('cancel')
frappe.db.set(self, 'status', 'Cancelled')
+
+ def update_project(self):
+ project_list = []
+ if self.project:
+ project = frappe.get_doc("Project", self.project)
+ project.flags.dont_sync_tasks = True
+ project.update_sales_costing()
+ project.save()
+ project_list.append(self.project)
def check_credit_limit(self):
from erpnext.selling.doctype.customer.customer import check_credit_limit
diff --git a/erpnext/utilities/activation.py b/erpnext/utilities/activation.py
index baede31..c4841bb 100644
--- a/erpnext/utilities/activation.py
+++ b/erpnext/utilities/activation.py
@@ -58,80 +58,94 @@
domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
- if domain in ('Manufacturing', 'Retail', 'Services', 'Distribution'):
- count = frappe.db.count('Lead')
- if count < 3:
- messages.append(dict(
- title=_('Create Leads'),
- description=_('Leads help you get business, add all your contacts and more as your leads'),
- action=_('Make Lead'),
- route='List/Lead',
- count=count
- ))
-
- count = frappe.db.count('Quotation')
- if count < 3:
- messages.append(dict(
- title=_('Create customer quotes'),
- description=_('Quotations are proposals, bids you have sent to your customers'),
- action=_('Make Quotation'),
- route='List/Quotation'
- ))
-
- count = frappe.db.count('Sales Order')
- if count < 3:
- messages.append(dict(
- title=_('Manage your orders'),
- description=_('Make Sales Orders to help you plan your work and deliver on-time'),
- action=_('Make Sales Order'),
- route='List/Sales Order'
- ))
-
- count = frappe.db.count('Purchase Order')
- if count < 3:
- messages.append(dict(
- title=_('Create Purchase Orders'),
- description=_('Purchase orders help you plan and follow up on your purchases'),
- action=_('Make Purchase Order'),
- route='List/Purchase Order'
- ))
-
- count = frappe.db.count('User')
- if count < 3:
- messages.append(dict(
- 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'),
- action=_('Make User'),
- route='List/User'
- ))
-
- elif domain == 'Education':
- count = frappe.db.count('Student')
- if count < 5:
- messages.append(dict(
- title=_('Add Students'),
- description=_('Students are at the heart of the system, add all your students'),
- action=_('Make Student'),
- route='List/Student'
- ))
-
- count = frappe.db.count('Student Batch')
- if count < 3:
- messages.append(dict(
- title=_('Group your students in batches'),
- description=_('Student Batches help you track attendance, assessments and fees for students'),
- action=_('Make Student Batch'),
- route='List/Student Batch'
- ))
-
- # anyways
- count = frappe.db.count('Employee')
- if count < 3:
- messages.append(dict(
+ message_settings = [
+ frappe._dict(
+ doctype='Lead',
+ title=_('Create Leads'),
+ description=_('Leads help you get business, add all your contacts and more as your leads'),
+ action=_('Make Lead'),
+ route='List/Lead',
+ domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
+ target=3
+ ),
+ frappe._dict(
+ doctype='Quotation',
+ title=_('Create customer quotes'),
+ description=_('Quotations are proposals, bids you have sent to your customers'),
+ action=_('Make Quotation'),
+ route='List/Quotation',
+ domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
+ target=3
+ ),
+ frappe._dict(
+ doctype='Sales Order',
+ title=_('Manage your orders'),
+ description=_('Make Sales Orders to help you plan your work and deliver on-time'),
+ action=_('Make Sales Order'),
+ route='List/Sales Order',
+ domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
+ target=3
+ ),
+ frappe._dict(
+ doctype='Purchase Order',
+ title=_('Create Purchase Orders'),
+ description=_('Purchase orders help you plan and follow up on your purchases'),
+ action=_('Make Purchase Order'),
+ route='List/Purchase Order',
+ domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
+ target=3
+ ),
+ frappe._dict(
+ doctype='User',
+ 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'),
+ action=_('Make User'),
+ route='List/User',
+ domain=('Manufacturing', 'Retail', 'Services', 'Distribution'),
+ target=3
+ ),
+ frappe._dict(
+ doctype='Timesheet',
+ 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'),
+ description=_('Students are at the heart of the system, add all your students'),
+ action=_('Make Student'),
+ route='List/Student',
+ domain=('Education',),
+ target=5
+ ),
+ frappe._dict(
+ doctype='Student Batch',
+ title=_('Group your students in batches'),
+ description=_('Student Batches help you track attendance, assessments and fees for students'),
+ action=_('Make Student Batch'),
+ route='List/Student Batch',
+ domain=('Education',),
+ target=3
+ ),
+ frappe._dict(
+ doctype='Employee',
title=_('Create Employee Records'),
description=_('Create Employee records to manage leaves, expense claims and payroll'),
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