report lead detail
This commit is contained in:
parent
6bab21483c
commit
d01caac852
@ -68,12 +68,6 @@ def get_columns():
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"width": 120
|
"width": 120
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"label": _("Notes"),
|
|
||||||
"fieldname": "notes",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"width": 120
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": _("Owner"),
|
"label": _("Owner"),
|
||||||
"fieldname": "owner",
|
"fieldname": "owner",
|
||||||
@ -129,7 +123,6 @@ def get_data(filters):
|
|||||||
`tabLead`.email_id,
|
`tabLead`.email_id,
|
||||||
`tabLead`.mobile_no,
|
`tabLead`.mobile_no,
|
||||||
`tabLead`.phone,
|
`tabLead`.phone,
|
||||||
`tabLead`.notes,
|
|
||||||
`tabLead`.owner,
|
`tabLead`.owner,
|
||||||
`tabLead`.company,
|
`tabLead`.company,
|
||||||
concat_ws(', ',
|
concat_ws(', ',
|
||||||
@ -153,12 +146,12 @@ def get_data(filters):
|
|||||||
`tabLead`.creation asc """.format(conditions=get_conditions(filters)), filters, as_dict=1)
|
`tabLead`.creation asc """.format(conditions=get_conditions(filters)), filters, as_dict=1)
|
||||||
|
|
||||||
def get_conditions(filters) :
|
def get_conditions(filters) :
|
||||||
conditions = []
|
conditions = ""
|
||||||
|
|
||||||
if filters.get("territory"):
|
if filters.get("territory"):
|
||||||
conditions.append("territory=%(territory)s")
|
conditions+=" and territory=%(territory)s "
|
||||||
|
|
||||||
if filters.get("status"):
|
if filters.get("status"):
|
||||||
conditions.append("status=%(status)s")
|
conditions+=" and status=%(status)s "
|
||||||
|
|
||||||
return " and {}".format(" and ".join(conditions)) if conditions else ""
|
return conditions
|
||||||
|
@ -50,6 +50,12 @@ def get_columns():
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "User",
|
"options": "User",
|
||||||
"width": 120
|
"width": 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Lost Reasons"),
|
||||||
|
"fieldname": "lost_reason",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"width": 220
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
return columns
|
return columns
|
||||||
@ -62,14 +68,20 @@ def get_data(filters):
|
|||||||
`tabOpportunity`.party_name,
|
`tabOpportunity`.party_name,
|
||||||
`tabOpportunity`.customer_name,
|
`tabOpportunity`.customer_name,
|
||||||
`tabOpportunity`.opportunity_type,
|
`tabOpportunity`.opportunity_type,
|
||||||
`tabOpportunity`.contact_by
|
`tabOpportunity`.contact_by,
|
||||||
|
GROUP_CONCAT(`tabLost Reason Detail`.lost_reason separator ', ') lost_reason
|
||||||
FROM
|
FROM
|
||||||
`tabOpportunity`
|
`tabOpportunity`
|
||||||
|
LEFT JOIN `tabLost Reason Detail`
|
||||||
|
ON `tabLost Reason Detail`.parenttype = 'Opportunity' and `tabLost Reason Detail`.parent = `tabOpportunity`.name
|
||||||
WHERE
|
WHERE
|
||||||
status = 'Lost' and company = %(company)s
|
`tabOpportunity`.status = 'Lost' and `tabOpportunity`.company = %(company)s
|
||||||
{conditions}
|
{conditions}
|
||||||
|
GROUP BY
|
||||||
|
`tabOpportunity`.name
|
||||||
ORDER BY
|
ORDER BY
|
||||||
creation asc """.format(conditions=get_conditions(filters)), filters, as_dict=1)
|
`tabOpportunity`.creation asc """.format(conditions=get_conditions(filters)), filters, as_dict=1)
|
||||||
|
|
||||||
|
|
||||||
def get_conditions(filters) :
|
def get_conditions(filters) :
|
||||||
conditions = []
|
conditions = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user