fix: mentions in notes, workspace links, no-of-employees field type and report fixes
diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js
index 37fb350..b98a27e 100644
--- a/erpnext/crm/doctype/lead/lead.js
+++ b/erpnext/crm/doctype/lead/lead.js
@@ -54,7 +54,6 @@
frappe.contacts.clear_address_and_contact(this.frm);
}
- this.frm.dashboard.links_area.hide();
this.show_notes();
this.show_activities();
}
diff --git a/erpnext/crm/doctype/lead/lead.json b/erpnext/crm/doctype/lead/lead.json
index d47373f..c946ae4 100644
--- a/erpnext/crm/doctype/lead/lead.json
+++ b/erpnext/crm/doctype/lead/lead.json
@@ -74,7 +74,8 @@
"all_activities_html",
"notes_tab",
"notes_html",
- "notes"
+ "notes",
+ "dashboard_tab"
],
"fields": [
{
@@ -337,9 +338,10 @@
},
{
"fieldname": "no_of_employees",
- "fieldtype": "Int",
- "label": "No. of Employees"
- },
+ "fieldtype": "Select",
+ "label": "No of Employees",
+ "options": "1-10\n11-20\n21-30\n31-100\n11-50\n51-200\n201-500\n101-500\n500-1000\n501-1000\n>1000\n1000+"
+ },
{
"fieldname": "column_break_22",
"fieldtype": "Column Break"
@@ -500,13 +502,19 @@
"fieldtype": "Link",
"label": "Country",
"options": "Country"
+ },
+ {
+ "fieldname": "dashboard_tab",
+ "fieldtype": "Tab Break",
+ "label": "Dashboard",
+ "show_dashboard": 1
}
],
"icon": "fa fa-user",
"idx": 5,
"image_field": "image",
"links": [],
- "modified": "2022-06-27 21:56:17.392756",
+ "modified": "2022-07-22 15:55:03.176094",
"modified_by": "Administrator",
"module": "CRM",
"name": "Lead",
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index c53ea9d..1f76a1a 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -84,7 +84,7 @@
erpnext.toggle_naming_series();
if(!frm.is_new() && doc.status!=="Lost") {
- if(doc.with_items){
+ if(doc.items){
frm.add_custom_button(__('Supplier Quotation'),
function() {
frm.trigger("make_supplier_quotation")
diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json
index 1a6f23b..68a2156 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.json
+++ b/erpnext/crm/doctype/opportunity/opportunity.json
@@ -225,16 +225,12 @@
"fieldname": "items_section",
"fieldtype": "Tab Break",
"label": "Items",
- "oldfieldtype": "Section Break",
"options": "fa fa-shopping-cart"
},
{
"fieldname": "items",
"fieldtype": "Table",
"label": "Items",
- "mandatory_depends_on": "eval: doc.with_items == 1",
- "oldfieldname": "enquiry_details",
- "oldfieldtype": "Table",
"options": "Opportunity Item"
},
{
@@ -409,7 +405,6 @@
"read_only": 1
},
{
- "depends_on": "with_items",
"fieldname": "section_break_32",
"fieldtype": "Section Break",
"hide_border": 1
@@ -466,8 +461,9 @@
},
{
"fieldname": "no_of_employees",
- "fieldtype": "Int",
- "label": "No of Employees"
+ "fieldtype": "Select",
+ "label": "No of Employees",
+ "options": "1-10\n11-20\n21-30\n31-100\n11-50\n51-200\n201-500\n101-500\n500-1000\n501-1000\n>1000\n1000+"
},
{
"fieldname": "annual_revenue",
@@ -626,7 +622,7 @@
"icon": "fa fa-info-sign",
"idx": 195,
"links": [],
- "modified": "2022-06-27 18:44:32.858696",
+ "modified": "2022-07-22 18:46:32.858696",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity",
diff --git a/erpnext/crm/doctype/prospect/prospect.json b/erpnext/crm/doctype/prospect/prospect.json
index afc6c1d..7f33c08 100644
--- a/erpnext/crm/doctype/prospect/prospect.json
+++ b/erpnext/crm/doctype/prospect/prospect.json
@@ -218,7 +218,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2022-06-21 15:10:26.887502",
+ "modified": "2022-06-22 15:10:26.887502",
"modified_by": "Administrator",
"module": "CRM",
"name": "Prospect",
diff --git a/erpnext/crm/report/opportunity_summary_by_sales_stage/opportunity_summary_by_sales_stage.py b/erpnext/crm/report/opportunity_summary_by_sales_stage/opportunity_summary_by_sales_stage.py
index 3a46fb0..8093117 100644
--- a/erpnext/crm/report/opportunity_summary_by_sales_stage/opportunity_summary_by_sales_stage.py
+++ b/erpnext/crm/report/opportunity_summary_by_sales_stage/opportunity_summary_by_sales_stage.py
@@ -201,26 +201,21 @@
def get_chart_data(self):
labels = []
datasets = []
- values = [0] * 8
-
- for sales_stage in self.sales_stage_list:
- labels.append(sales_stage)
+ values = [0] * len(self.sales_stage_list)
options = {"Number": "count", "Amount": "amount"}[self.filters.get("data_based_on")]
for data in self.query_result:
- for count in range(len(values)):
- if data["sales_stage"] == labels[count]:
+ for count in range(len(self.sales_stage_list)):
+ if data["sales_stage"] == self.sales_stage_list[count]:
values[count] = values[count] + data[options]
datasets.append({"name": options, "values": values})
+ self.chart = {"data": {"labels": self.sales_stage_list, "datasets": datasets}, "type": "line"}
- self.chart = {"data": {"labels": labels, "datasets": datasets}, "type": "line"}
-
- def currency_conversion(self, from_currency, to_currency):
+ def get_exchange_rate(self, from_currency, to_currency):
cacheobj = frappe.cache()
-
- if cacheobj.get(from_currency):
+ if cacheobj and cacheobj.get(from_currency):
return flt(str(cacheobj.get(from_currency), "UTF-8"))
else:
@@ -235,7 +230,7 @@
def convert_to_base_currency(self):
default_currency = self.get_default_currency()
for data in self.query_result:
- if data.get("currency") != default_currency:
+ if data.get("currency") and data.get("currency") != default_currency:
opportunity_currency = data.get("currency")
- value = self.currency_conversion(opportunity_currency, default_currency)
- data["amount"] = data["amount"] * value
+ exchange_rate = self.get_exchange_rate(opportunity_currency, default_currency)
+ data["amount"] = data["amount"] * exchange_rate
diff --git a/erpnext/crm/utils.py b/erpnext/crm/utils.py
index a2528c3..433d974 100644
--- a/erpnext/crm/utils.py
+++ b/erpnext/crm/utils.py
@@ -1,4 +1,5 @@
import frappe
+from frappe.desk.notifications import notify_mentions
from frappe.model.document import Document
from frappe.utils import cstr, now, today
from pypika import functions
@@ -204,6 +205,7 @@
def add_note(self, note):
self.append("notes", {"note": note, "added_by": frappe.session.user, "added_on": now()})
self.save()
+ notify_mentions(self.doctype, self.name, note)
@frappe.whitelist()
def edit_note(self, note, row_id):
diff --git a/erpnext/crm/workspace/crm/crm.json b/erpnext/crm/workspace/crm/crm.json
index 83341f5..318754b 100644
--- a/erpnext/crm/workspace/crm/crm.json
+++ b/erpnext/crm/workspace/crm/crm.json
@@ -5,7 +5,7 @@
"label": "Territory Wise Sales"
}
],
- "content": "[{\"type\":\"onboarding\",\"data\":{\"onboarding_name\":\"CRM\",\"col\":12}},{\"type\":\"chart\",\"data\":{\"chart_name\":\"Territory Wise Sales\",\"col\":12}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Your Shortcuts</b></span>\",\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Lead\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Opportunity\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Customer\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Analytics\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Dashboard\",\"col\":3}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Reports & Masters</b></span>\",\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Sales Pipeline\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Reports\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Maintenance\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Campaign\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Settings\",\"col\":4}}]",
+ "content": "[{\"type\":\"chart\",\"data\":{\"chart_name\":\"Territory Wise Sales\",\"col\":12}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Your Shortcuts</b></span>\",\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Lead\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Opportunity\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Customer\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Analytics\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Dashboard\",\"col\":3}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Reports & Masters</b></span>\",\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Sales Pipeline\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Reports\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Campaign\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Settings\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Maintenance\",\"col\":4}}]",
"creation": "2020-01-23 14:48:30.183272",
"docstatus": 0,
"doctype": "Workspace",
@@ -49,6 +49,17 @@
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
+ "label": "Prospect",
+ "link_count": 0,
+ "link_to": "Prospect",
+ "link_type": "DocType",
+ "onboard": 1,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
"label": "Customer",
"link_count": 0,
"link_to": "Customer",
@@ -82,17 +93,6 @@
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
- "label": "Lead Source",
- "link_count": 0,
- "link_to": "Lead Source",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
"label": "Contract",
"link_count": 0,
"link_to": "Contract",
@@ -123,6 +123,60 @@
"type": "Link"
},
{
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Lead Source",
+ "link_count": 0,
+ "link_to": "Lead Source",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Territory",
+ "link_count": 0,
+ "link_to": "Territory",
+ "link_type": "DocType",
+ "onboard": 1,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Customer Group",
+ "link_count": 0,
+ "link_to": "Customer Group",
+ "link_type": "DocType",
+ "onboard": 1,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Sales Person",
+ "link_count": 0,
+ "link_to": "Sales Person",
+ "link_type": "DocType",
+ "onboard": 1,
+ "type": "Link"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Sales Stage",
+ "link_count": 0,
+ "link_to": "Sales Stage",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
"hidden": 0,
"is_query_report": 0,
"label": "Reports",
@@ -230,47 +284,6 @@
{
"hidden": 0,
"is_query_report": 0,
- "label": "Maintenance",
- "link_count": 0,
- "onboard": 0,
- "type": "Card Break"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Maintenance Schedule",
- "link_count": 0,
- "link_to": "Maintenance Schedule",
- "link_type": "DocType",
- "onboard": 1,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Maintenance Visit",
- "link_count": 0,
- "link_to": "Maintenance Visit",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Warranty Claim",
- "link_count": 0,
- "link_to": "Warranty Claim",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "hidden": 0,
- "is_query_report": 0,
"label": "Campaign",
"link_count": 0,
"onboard": 0,
@@ -310,47 +323,6 @@
"type": "Link"
},
{
- "hidden": 0,
- "is_query_report": 0,
- "label": "Settings",
- "link_count": 0,
- "onboard": 0,
- "type": "Card Break"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Customer Group",
- "link_count": 0,
- "link_to": "Customer Group",
- "link_type": "DocType",
- "onboard": 1,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Territory",
- "link_count": 0,
- "link_to": "Territory",
- "link_type": "DocType",
- "onboard": 1,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Sales Person",
- "link_count": 0,
- "link_to": "Sales Person",
- "link_type": "DocType",
- "onboard": 1,
- "type": "Link"
- },
- {
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
@@ -376,9 +348,27 @@
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
- "label": "SMS Settings",
+ "label": "Email Group",
"link_count": 0,
- "link_to": "SMS Settings",
+ "link_to": "Email Group",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Settings",
+ "link_count": 0,
+ "onboard": 0,
+ "type": "Card Break"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "CRM Settings",
+ "link_count": 0,
+ "link_to": "CRM Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
@@ -387,9 +377,9 @@
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
- "label": "Email Group",
+ "label": "SMS Settings",
"link_count": 0,
- "link_to": "Email Group",
+ "link_to": "SMS Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
@@ -415,15 +405,57 @@
"link_type": "DocType",
"onboard": 0,
"type": "Link"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Maintenance",
+ "link_count": 0,
+ "onboard": 0,
+ "type": "Card Break"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Maintenance Schedule",
+ "link_count": 0,
+ "link_to": "Maintenance Schedule",
+ "link_type": "DocType",
+ "onboard": 1,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Maintenance Visit",
+ "link_count": 0,
+ "link_to": "Maintenance Visit",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Warranty Claim",
+ "link_count": 0,
+ "link_to": "Warranty Claim",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
}
],
- "modified": "2022-01-13 17:53:17.509844",
+ "modified": "2022-07-22 15:03:30.755417",
"modified_by": "Administrator",
"module": "CRM",
"name": "CRM",
"owner": "Administrator",
"parent_page": "",
"public": 1,
+ "quick_lists": [],
"restrict_to_domain": "",
"roles": [],
"sequence_id": 7.0,
diff --git a/erpnext/public/js/utils/crm_activities.js b/erpnext/public/js/utils/crm_activities.js
index bbd9ded..ec79a10 100644
--- a/erpnext/public/js/utils/crm_activities.js
+++ b/erpnext/public/js/utils/crm_activities.js
@@ -143,7 +143,8 @@
"label": "Note",
"fieldname": "note",
"fieldtype": "Text Editor",
- "reqd": 1
+ "reqd": 1,
+ "enable_mentions": true,
}
],
primary_action: function() {