fix: conditionally set lead title as organization or person
This commit is contained in:
parent
312210c2b0
commit
f9e2bfcc29
@ -54,7 +54,8 @@
|
||||
"website",
|
||||
"territory",
|
||||
"unsubscribed",
|
||||
"blog_subscriber"
|
||||
"blog_subscriber",
|
||||
"title"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@ -409,6 +410,13 @@
|
||||
"fieldtype": "Data",
|
||||
"label": "Postal Code",
|
||||
"options": "Country"
|
||||
},
|
||||
{
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Title",
|
||||
"print_hide": 1
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-user",
|
||||
@ -477,5 +485,5 @@
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "lead_name"
|
||||
"title_field": "title"
|
||||
}
|
@ -36,6 +36,7 @@ class Lead(SellingController):
|
||||
|
||||
def validate(self):
|
||||
self.set_lead_name()
|
||||
self.set_title()
|
||||
self._prev = frappe._dict({
|
||||
"contact_date": frappe.db.get_value("Lead", self.name, "contact_date") if (not cint(self.is_new())) else None,
|
||||
"ends_on": frappe.db.get_value("Lead", self.name, "ends_on") if (not cint(self.is_new())) else None,
|
||||
@ -120,6 +121,12 @@ class Lead(SellingController):
|
||||
|
||||
self.lead_name = self.company_name
|
||||
|
||||
def set_title(self):
|
||||
if self.organization_lead:
|
||||
self.title = self.company_name
|
||||
else:
|
||||
self.title = self.lead_name
|
||||
|
||||
def create_address(self):
|
||||
address_fields = ["address_title", "address_line1", "address_line2",
|
||||
"city", "county", "state", "country", "pincode"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user