fix: mentions in notes, workspace links, no-of-employees field type and report fixes

This commit is contained in:
Nabin Hait 2022-07-22 15:33:23 +05:30
parent 538f5a9964
commit 29b8715205
9 changed files with 163 additions and 130 deletions

View File

@ -54,7 +54,6 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
frappe.contacts.clear_address_and_contact(this.frm);
}
this.frm.dashboard.links_area.hide();
this.show_notes();
this.show_activities();
}

View File

@ -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",

View File

@ -84,7 +84,7 @@ frappe.ui.form.on("Opportunity", {
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")

View File

@ -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",

View File

@ -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",

View File

@ -201,26 +201,21 @@ class OpportunitySummaryBySalesStage(object):
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 @@ class OpportunitySummaryBySalesStage(object):
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

View File

@ -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 @@ class CRMNote(Document):
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):

View File

@ -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 &amp; 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",
@ -45,6 +45,17 @@
"onboard": 1,
"type": "Link"
},
{
"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,
@ -78,17 +89,6 @@
"onboard": 0,
"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,
@ -122,6 +122,60 @@
"onboard": 0,
"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,
@ -227,47 +281,6 @@
"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"
},
{
"hidden": 0,
"is_query_report": 0,
@ -309,47 +322,6 @@
"onboard": 0,
"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,
@ -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,

View File

@ -143,7 +143,8 @@ erpnext.utils.CRMNotes = class CRMNotes {
"label": "Note",
"fieldname": "note",
"fieldtype": "Text Editor",
"reqd": 1
"reqd": 1,
"enable_mentions": true,
}
],
primary_action: function() {