top bar fix
This commit is contained in:
parent
88a4c44cfa
commit
60cc0cc173
@ -114,12 +114,14 @@ class DocType():
|
|||||||
doctype = doctype, email_field = args["email_field"])
|
doctype = doctype, email_field = args["email_field"])
|
||||||
|
|
||||||
lead_naming_series = None
|
lead_naming_series = None
|
||||||
def create_lead(email):
|
def create_lead(email_id):
|
||||||
"""create a lead if it does not exist"""
|
"""create a lead if it does not exist"""
|
||||||
|
from email.utils import parseaddr
|
||||||
|
real_name, email_id = parseaddr(email_id)
|
||||||
lead = Document("Lead")
|
lead = Document("Lead")
|
||||||
lead.fields["__islocal"] = 1
|
lead.fields["__islocal"] = 1
|
||||||
lead.lead_name = email
|
lead.lead_name = real_name or email_id
|
||||||
lead.email_id = email
|
lead.email_id = email_id
|
||||||
lead.status = "Open"
|
lead.status = "Open"
|
||||||
lead.naming_series = lead_naming_series or get_lead_naming_series()
|
lead.naming_series = lead_naming_series or get_lead_naming_series()
|
||||||
lead.company = webnotes.conn.get_default("company")
|
lead.company = webnotes.conn.get_default("company")
|
||||||
|
@ -189,7 +189,7 @@ def get_outer_env():
|
|||||||
select * from `tabTop Bar Item`
|
select * from `tabTop Bar Item`
|
||||||
where parent='Website Settings' and parentfield='top_bar_items'
|
where parent='Website Settings' and parentfield='top_bar_items'
|
||||||
order by idx asc""", as_dict=1)
|
order by idx asc""", as_dict=1)
|
||||||
|
|
||||||
top_items = [d for d in all_top_items if not d['parent_label']]
|
top_items = [d for d in all_top_items if not d['parent_label']]
|
||||||
|
|
||||||
# attach child items to top bar
|
# attach child items to top bar
|
||||||
@ -202,7 +202,7 @@ def get_outer_env():
|
|||||||
t['child_items'].append(d)
|
t['child_items'].append(d)
|
||||||
break
|
break
|
||||||
|
|
||||||
if "products" in [d.url.split(".")[0] for d in top_items]:
|
if top_items and ("products" in [d.url.split(".")[0] for d in top_items]):
|
||||||
# product categories
|
# product categories
|
||||||
products = webnotes.conn.sql("""select t1.item_group as label,
|
products = webnotes.conn.sql("""select t1.item_group as label,
|
||||||
concat(t2.page_name, ".html") as url,
|
concat(t2.page_name, ".html") as url,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user