report lost opportunity
diff --git a/erpnext/crm/report/lead_details/lead_details.py b/erpnext/crm/report/lead_details/lead_details.py
index 5b1849a..079f32e 100644
--- a/erpnext/crm/report/lead_details/lead_details.py
+++ b/erpnext/crm/report/lead_details/lead_details.py
@@ -6,7 +6,7 @@
 import frappe
 
 def execute(filters=None):
-	columns, data = get_columns(), get_leads(filters)
+	columns, data = get_columns(), get_data(filters)
 	return columns, data
 
 def get_columns():
@@ -117,7 +117,7 @@
 	]
 	return columns
 
-def get_leads(filters):
+def get_data(filters):
 	return frappe.db.sql("""
 		SELECT
 			`tabLead`.name,
diff --git a/erpnext/crm/report/lost_opportunity/lost_opportunity.js b/erpnext/crm/report/lost_opportunity/lost_opportunity.js
new file mode 100644
index 0000000..c6bf888
--- /dev/null
+++ b/erpnext/crm/report/lost_opportunity/lost_opportunity.js
@@ -0,0 +1,41 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+/* eslint-disable */
+
+frappe.query_reports["Lost Opportunity"] = {
+	"filters": [
+		{
+			"fieldname":"company",
+			"label": __("Company"),
+			"fieldtype": "Link",
+			"options": "Company",
+			"default": frappe.defaults.get_user_default("Company"),
+			"reqd": 1
+		},
+		{
+			"fieldname":"opportunity_from",
+			"label": __("Opportunity From"),
+			"fieldtype": "Link",
+			"options": "DocType",
+			"get_query": function() {
+				return {
+					"filters": {
+						"name": ["in", ["Customer", "Lead"]],
+					}
+				}
+			}
+		},
+		{
+			"fieldname":"party_name",
+			"label": __("Party"),
+			"fieldtype": "Dynamic Link",
+			"options": "opportunity_from"
+		},
+		{
+			"fieldname":"contact_by",
+			"label": __("Next Contact By"),
+			"fieldtype": "Link",
+			"options": "User"
+		},
+	]
+};
\ No newline at end of file
diff --git a/erpnext/crm/report/lost_opportunity/lost_opportunity.json b/erpnext/crm/report/lost_opportunity/lost_opportunity.json
index e7c5068..e7a8e12 100644
--- a/erpnext/crm/report/lost_opportunity/lost_opportunity.json
+++ b/erpnext/crm/report/lost_opportunity/lost_opportunity.json
@@ -1,13 +1,14 @@
 {
  "add_total_row": 0,
  "creation": "2018-12-31 16:30:57.188837",
+ "disable_prepared_report": 0,
  "disabled": 0,
  "docstatus": 0,
  "doctype": "Report",
  "idx": 0,
  "is_standard": "Yes",
  "json": "{\"order_by\": \"`tabOpportunity`.`modified` desc\", \"filters\": [[\"Opportunity\", \"status\", \"=\", \"Lost\"]], \"fields\": [[\"name\", \"Opportunity\"], [\"opportunity_from\", \"Opportunity\"], [\"party_name\", \"Opportunity\"], [\"customer_name\", \"Opportunity\"], [\"opportunity_type\", \"Opportunity\"], [\"status\", \"Opportunity\"], [\"contact_by\", \"Opportunity\"], [\"docstatus\", \"Opportunity\"], [\"lost_reason\", \"Lost Reason Detail\"]], \"add_totals_row\": 0, \"add_total_row\": 0, \"page_length\": 20}",
- "modified": "2019-06-26 16:33:08.083618",
+ "modified": "2020-07-29 15:49:02.848845",
  "modified_by": "Administrator",
  "module": "CRM",
  "name": "Lost Opportunity",
@@ -15,7 +16,7 @@
  "prepared_report": 0,
  "ref_doctype": "Opportunity",
  "report_name": "Lost Opportunity",
- "report_type": "Report Builder",
+ "report_type": "Script Report",
  "roles": [
   {
    "role": "Sales User"
diff --git a/erpnext/crm/report/lost_opportunity/lost_opportunity.py b/erpnext/crm/report/lost_opportunity/lost_opportunity.py
new file mode 100644
index 0000000..75c0b2d
--- /dev/null
+++ b/erpnext/crm/report/lost_opportunity/lost_opportunity.py
@@ -0,0 +1,86 @@
+# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe import _
+import frappe
+
+def execute(filters=None):
+	columns, data = get_columns(), get_data(filters)
+	return columns, data
+
+def get_columns():
+	columns = [
+		{
+			"label": _("Opportunity"),
+			"fieldname": "name",
+			"fieldtype": "Link",
+			"options": "Opportunity",
+			"width": 170,
+		},
+		{
+			"label": _("Opportunity From"),
+			"fieldname": "opportunity_from",
+			"fieldtype": "Link",
+			"options": "DocType",
+			"width": 130
+		},
+		{
+			"label": _("Party"),
+			"fieldname":"party_name",
+			"fieldtype": "Dynamic Link",
+			"options": "opportunity_from",
+			"width": 160
+		},
+		{
+			"label": _("Customer/Lead Name"),
+			"fieldname":"customer_name",
+			"fieldtype": "Data",
+			"width": 150
+		},
+		{
+			"label": _("Opportunity Type"),
+			"fieldname": "opportunity_type",
+			"fieldtype": "Data",
+			"width": 130
+		},
+		{
+			"label": _("Next Contact By"),
+			"fieldname": "contact_by",
+			"fieldtype": "Link",
+			"options": "User",
+			"width": 120
+		}
+	]
+	return columns
+
+def get_data(filters):
+	return frappe.db.sql("""
+		SELECT
+			`tabOpportunity`.name,
+			`tabOpportunity`.opportunity_from,
+			`tabOpportunity`.party_name,
+			`tabOpportunity`.customer_name,
+			`tabOpportunity`.opportunity_type,
+			`tabOpportunity`.contact_by
+		FROM
+			`tabOpportunity`
+		WHERE
+			status = 'Lost' and company = %(company)s
+			{conditions}
+		ORDER BY 
+			creation asc """.format(conditions=get_conditions(filters)), filters, as_dict=1)
+
+def get_conditions(filters) :
+	conditions = []
+
+	if filters.get("opportunity_from"):
+		conditions.append("opportunity_from=%(opportunity_from)s")
+
+	if filters.get("party_name"):
+		conditions.append("party_name=%(party_name)s")
+
+	if filters.get("contact_by"):
+		conditions.append("contact_by=%(contact_by)s")
+
+	return " and {}".format(" and ".join(conditions)) if conditions else ""