fix: replaced organization_name (data) with organization (link)

also made other organization field fetch from organization
This commit is contained in:
Shariq Ansari 2023-11-06 15:55:12 +05:30
parent 7bb885b6af
commit c4d8dbad88
3 changed files with 66 additions and 29 deletions

View File

@ -29,9 +29,8 @@
"next_step",
"organization_tab",
"section_break_uixv",
"organization_name",
"organization",
"no_of_employees",
"organization_logo",
"column_break_dbsv",
"website",
"job_title",
@ -111,10 +110,12 @@
"search_index": 1
},
{
"fetch_from": "organization.website",
"fieldname": "website",
"fieldtype": "Data",
"label": "Website",
"options": "URL"
"options": "URL",
"read_only": 1
},
{
"fieldname": "column_break_sijm",
@ -146,17 +147,15 @@
"fieldname": "no_of_employees",
"fieldtype": "Select",
"label": "No. of Employees",
"options": "1-10\n11-50\n51-200\n201-500\n501-1000\n1000+"
},
{
"fieldname": "organization_name",
"fieldtype": "Data",
"label": "Organization Name"
"options": "1-10\n11-50\n51-200\n201-500\n501-1000\n1000+",
"read_only": 1
},
{
"fetch_from": "organization.annual_revenue",
"fieldname": "annual_revenue",
"fieldtype": "Currency",
"label": "Annual Revenue"
"label": "Annual Revenue",
"read_only": 1
},
{
"fieldname": "lead_owner",
@ -171,15 +170,11 @@
"options": "CRM Lead Source"
},
{
"fetch_from": "organization.industry",
"fieldname": "industry",
"fieldtype": "Link",
"fieldtype": "Data",
"label": "Industry",
"options": "CRM Industry"
},
{
"fieldname": "organization_logo",
"fieldtype": "Attach Image",
"label": "Organization Logo"
"read_only": 1
},
{
"fieldname": "image",
@ -214,9 +209,11 @@
"search_index": 1
},
{
"fetch_from": "organization.job_title",
"fieldname": "job_title",
"fieldtype": "Data",
"label": "Job Title"
"label": "Job Title",
"read_only": 1
},
{
"fieldname": "organization_tab",
@ -259,12 +256,18 @@
"fieldtype": "Check",
"hidden": 1,
"label": "Created as Deal"
},
{
"fieldname": "organization",
"fieldtype": "Link",
"label": "Organization",
"options": "CRM Organization"
}
],
"image_field": "image",
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-09-27 18:54:18.196159",
"modified": "2023-11-06 15:29:56.868755",
"modified_by": "Administrator",
"module": "FCRM",
"name": "CRM Lead",

View File

@ -26,15 +26,17 @@ class CRMLead(Document):
def set_lead_name(self):
if not self.lead_name:
# Check for leads being created through data import
if not self.organization_name and not self.email and not self.flags.ignore_mandatory:
if not self.organization and not self.email and not self.flags.ignore_mandatory:
frappe.throw(_("A Lead requires either a person's name or an organization's name"))
elif self.organization_name:
self.lead_name = self.organization_name
else:
elif self.organization:
self.lead_name = self.organization
elif self.email:
self.lead_name = self.email.split("@")[0]
else:
self.lead_name = "Unnamed Lead"
def set_title(self):
self.title = self.organization_name or self.lead_name
self.title = self.organization or self.lead_name
def validate_email(self):
if self.email:
@ -106,7 +108,7 @@ class CRMLead(Document):
"salutation": self.salutation,
"gender": self.gender,
"designation": self.job_title,
"company_name": self.organization_name,
"company_name": self.organization,
"image": self.image or "",
}
)
@ -132,7 +134,7 @@ class CRMLead(Document):
{ "label": 'Modified', "value": 'modified' },
{ "label": 'Status', "value": 'status' },
{ "label": 'Lead owner', "value": 'lead_owner' },
{ "label": 'Organization', "value": 'organization_name' },
{ "label": 'Organization', "value": 'organization' },
{ "label": 'Name', "value": 'lead_name' },
{ "label": 'First Name', "value": 'first_name' },
{ "label": 'Last Name', "value": 'last_name' },

View File

@ -7,8 +7,13 @@
"engine": "InnoDB",
"field_order": [
"organization_name",
"no_of_employees",
"organization_logo",
"column_break_pnpp",
"website",
"organization_logo"
"job_title",
"annual_revenue",
"industry"
],
"fields": [
{
@ -20,18 +25,45 @@
{
"fieldname": "website",
"fieldtype": "Data",
"label": "Website"
"label": "Website",
"options": "URL"
},
{
"fieldname": "organization_logo",
"fieldtype": "Attach Image",
"label": "Organization Logo"
},
{
"fieldname": "no_of_employees",
"fieldtype": "Select",
"label": "No. of Employees",
"options": "1-10\n11-50\n51-200\n201-500\n501-1000\n1000+"
},
{
"fieldname": "column_break_pnpp",
"fieldtype": "Column Break"
},
{
"fieldname": "job_title",
"fieldtype": "Data",
"label": "Job Title"
},
{
"fieldname": "annual_revenue",
"fieldtype": "Currency",
"label": "Annual Revenue"
},
{
"fieldname": "industry",
"fieldtype": "Link",
"label": "Industry",
"options": "CRM Industry"
}
],
"image_field": "organization_logo",
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-11-03 16:25:25.366741",
"modified": "2023-11-06 15:28:26.610882",
"modified_by": "Administrator",
"module": "FCRM",
"name": "CRM Organization",