Changes after review
diff --git a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
index aad64ff..3088332 100644
--- a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
+++ b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
@@ -29,7 +29,7 @@
if filters.to_date:
conditions += " and date(creation) <= %(to_date)s"
data = frappe.db.sql("""select campaign_name as "Campaign Name", count(name) as "Lead Count" from `tabLead`
- where 1 = 1 %s group by campaign_name""" % (conditions,),filters, as_dict=1)
+ where 1 = 1 %s group by campaign_name""" % (conditions,),filters, as_dict=1)
dl=list(data)
for row in dl:
is_quot_count_zero = False
@@ -50,24 +50,21 @@
def get_lead_quotation_count(campaign):
quotation_count = frappe.db.sql("""select count(name) from `tabQuotation`
- where lead in (select name from `tabLead` where campaign_name = %s)""",campaign)
+ where lead in (select name from `tabLead` where campaign_name = %s)""",campaign)
return flt(quotation_count[0][0]) if quotation_count else 0
def get_lead_opp_count(campaign):
opportunity_count = frappe.db.sql("""select count(name) from `tabOpportunity`
- where lead in (select name from `tabLead` where campaign_name = %s)""",campaign)
+ where lead in (select name from `tabLead` where campaign_name = %s)""",campaign)
return flt(opportunity_count[0][0]) if opportunity_count else 0
def get_quotation_ordered_count(campaign):
- quotation_ordered_count = frappe.db.sql("""select count(name) from `tabQuotation`
- where status = 'Ordered' and lead in
- (select name from `tabLead` where campaign_name = %s)""",campaign)
+ quotation_ordered_count = frappe.db.sql("""select count(name) from `tabQuotation` where status = 'Ordered'
+ and lead in (select name from `tabLead` where campaign_name = %s)""",campaign)
return flt(quotation_ordered_count[0][0]) if quotation_ordered_count else 0
def get_order_amount(campaign):
- ordered_count_amount = frappe.db.sql("""select sum(base_net_amount) from `tabSales Order Item`
- where prevdoc_docname in
- (select name from `tabQuotation`
- where status = 'Ordered' and lead in
- (select name from `tabLead` where campaign_name = %s))""",campaign)
+ ordered_count_amount = frappe.db.sql("""select sum(base_net_amount) from `tabSales Order Item`
+ where prevdoc_docname in (select name from `tabQuotation` where status = 'Ordered' and
+ lead in (select name from `tabLead` where campaign_name = %s))""",campaign)
return flt(ordered_count_amount[0][0]) if ordered_count_amount else 0
\ No newline at end of file
diff --git a/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py
index 7ac5518..1560f86 100644
--- a/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py
+++ b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py
@@ -28,7 +28,8 @@
conditions += " and date(creation) >= %(from_date)s"
if filters.to_date:
conditions += " and date(creation) <= %(to_date)s"
- data = frappe.db.sql("""select lead_owner as "Lead Owner", count(name) as "Lead Count" from `tabLead` where 1 = 1 %s group by lead_owner""" % (conditions,),filters, as_dict=1)
+ data = frappe.db.sql("""select lead_owner as "Lead Owner", count(name) as "Lead Count"
+ from `tabLead` where 1 = 1 %s group by lead_owner""" % (conditions,),filters, as_dict=1)
dl=list(data)
for row in dl:
is_quot_count_zero = False
@@ -49,23 +50,23 @@
def get_lead_quotation_count(leadowner):
quotation_count = frappe.db.sql("""select count(name) from `tabQuotation`
- where lead in (select name from `tabLead` where lead_owner = %s)""",leadowner)
+ where lead in (select name from `tabLead` where lead_owner = %s)""",leadowner)
return flt(quotation_count[0][0]) if quotation_count else 0
def get_lead_opp_count(leadowner):
opportunity_count = frappe.db.sql("""select count(name) from `tabOpportunity`
- where lead in (select name from `tabLead` where lead_owner = %s)""",leadowner)
+ where lead in (select name from `tabLead` where lead_owner = %s)""",leadowner)
return flt(opportunity_count[0][0]) if opportunity_count else 0
def get_quotation_ordered_count(leadowner):
quotation_ordered_count = frappe.db.sql("""select count(name) from `tabQuotation`
- where status = 'Ordered' and lead in
- (select name from `tabLead` where lead_owner = %s)""",leadowner)
+ where status = 'Ordered' and lead in
+ (select name from `tabLead` where lead_owner = %s)""",leadowner)
return flt(quotation_ordered_count[0][0]) if quotation_ordered_count else 0
def get_order_amount(leadowner):
ordered_count_amount = frappe.db.sql("""select sum(base_net_amount) from `tabSales Order Item`
- where prevdoc_docname in (select name from `tabQuotation`
- where status = 'Ordered' and lead in
- (select name from `tabLead` where lead_owner = %s))""",leadowner)
+ where prevdoc_docname in (select name from `tabQuotation`
+ where status = 'Ordered' and lead in
+ (select name from `tabLead` where lead_owner = %s))""",leadowner)
return flt(ordered_count_amount[0][0]) if ordered_count_amount else 0
\ No newline at end of file