From 569815b5ad1a51abe21dd71ea25c887f1e780dc3 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sat, 11 May 2019 20:09:29 +0530 Subject: [PATCH] fix: Standard filter and dashboard fixes in quotation and opportunity --- erpnext/crm/doctype/lead/lead_dashboard.py | 4 ++-- erpnext/crm/doctype/opportunity/opportunity.json | 4 ++-- erpnext/crm/doctype/opportunity/opportunity_list.js | 8 ++++++++ .../selling/doctype/customer/customer_dashboard.py | 4 ++-- erpnext/selling/doctype/quotation/quotation.json | 6 +++--- erpnext/selling/doctype/quotation/quotation_list.js | 11 +++++++++++ 6 files changed, 28 insertions(+), 9 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead_dashboard.py b/erpnext/crm/doctype/lead/lead_dashboard.py index d58527e00cd..b33f12f5089 100644 --- a/erpnext/crm/doctype/lead/lead_dashboard.py +++ b/erpnext/crm/doctype/lead/lead_dashboard.py @@ -5,8 +5,8 @@ def get_data(): return { 'fieldname': 'lead', 'non_standard_fieldnames': { - 'Quotation': 'party_name', - 'Opportunity': 'party_name' + 'Quotation': 'customer_name', + 'Opportunity': 'customer_name' }, 'transactions': [ { diff --git a/erpnext/crm/doctype/opportunity/opportunity.json b/erpnext/crm/doctype/opportunity/opportunity.json index e3f43f40fd3..dc0d0bb6c2d 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.json +++ b/erpnext/crm/doctype/opportunity/opportunity.json @@ -136,7 +136,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 1, - "label": "Customer/Lead", + "label": "Party", "length": 0, "no_copy": 0, "oldfieldname": "customer", @@ -1468,7 +1468,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-04-25 18:55:43.874656", + "modified": "2019-05-11 19:22:33.533487", "modified_by": "Administrator", "module": "CRM", "name": "Opportunity", diff --git a/erpnext/crm/doctype/opportunity/opportunity_list.js b/erpnext/crm/doctype/opportunity/opportunity_list.js index 9712fb04c56..af53bf7fbf1 100644 --- a/erpnext/crm/doctype/opportunity/opportunity_list.js +++ b/erpnext/crm/doctype/opportunity/opportunity_list.js @@ -17,5 +17,13 @@ frappe.listview_settings['Opportunity'] = { listview.page.add_menu_item(__("Set as Closed"), function() { listview.call_for_selected_items(method, {"status": "Closed"}); }); + + listview.page.fields_dict.opportunity_from.get_query = function() { + return { + "filters": { + "name": ["in", ["Customer", "Lead"]], + } + }; + }; } }; diff --git a/erpnext/selling/doctype/customer/customer_dashboard.py b/erpnext/selling/doctype/customer/customer_dashboard.py index 6d6c86fbefd..67c69339ea9 100644 --- a/erpnext/selling/doctype/customer/customer_dashboard.py +++ b/erpnext/selling/doctype/customer/customer_dashboard.py @@ -7,8 +7,8 @@ def get_data(): 'heatmap_message': _('This is based on transactions against this Customer. See timeline below for details'), 'fieldname': 'customer', 'non_standard_fieldnames': { - 'Quotation': 'party_name', - 'Opportunity': 'party_name' + 'Quotation': 'customer_name', + 'Opportunity': 'customer_name' }, 'transactions': [ { diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 4083b8e6d0b..33fc4dbeb04 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -133,7 +133,7 @@ "in_filter": 0, "in_global_search": 0, "in_list_view": 0, - "in_standard_filter": 0, + "in_standard_filter": 1, "label": "Quotation To", "length": 0, "no_copy": 0, @@ -169,7 +169,7 @@ "in_filter": 0, "in_global_search": 1, "in_list_view": 0, - "in_standard_filter": 0, + "in_standard_filter": 1, "label": "Party", "length": 0, "no_copy": 0, @@ -3224,7 +3224,7 @@ "istable": 0, "max_attachments": 1, "menu_index": 0, - "modified": "2019-05-07 14:29:22.565474", + "modified": "2019-05-11 19:26:50.735628", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", diff --git a/erpnext/selling/doctype/quotation/quotation_list.js b/erpnext/selling/doctype/quotation/quotation_list.js index 8baf9b2518c..61a8bc1cab3 100644 --- a/erpnext/selling/doctype/quotation/quotation_list.js +++ b/erpnext/selling/doctype/quotation/quotation_list.js @@ -1,6 +1,17 @@ frappe.listview_settings['Quotation'] = { add_fields: ["customer_name", "base_grand_total", "status", "company", "currency", 'valid_till'], + + onload: function(listview) { + listview.page.fields_dict.quotation_to.get_query = function() { + return { + "filters": { + "name": ["in", ["Customer", "Lead"]], + } + }; + }; + }, + get_indicator: function(doc) { if(doc.status==="Submitted") { if (doc.valid_till && doc.valid_till < frappe.datetime.nowdate()) {