From a5fcaf66f9e6a8a9935af5da680bf1f48e1eca9e Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 19 May 2020 13:05:22 +0530 Subject: [PATCH] fix: Added filters in number Cards --- erpnext/stock/dashboard_fixtures.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/erpnext/stock/dashboard_fixtures.py b/erpnext/stock/dashboard_fixtures.py index db955c39c9..d1a3a146a2 100644 --- a/erpnext/stock/dashboard_fixtures.py +++ b/erpnext/stock/dashboard_fixtures.py @@ -24,7 +24,10 @@ def get_company_for_dashboards(): return None company = frappe.get_doc("Company", get_company_for_dashboards()) -fiscal_year = get_fiscal_year(nowdate(), as_dict=1).get("name") +fiscal_year = get_fiscal_year(nowdate(), as_dict=1) +fiscal_year_name = fiscal_year.get("name") +start_date = str(fiscal_year.get("year_start_date")) +end_date = str(fiscal_year.get("year_end_date")) def get_dashboards(): return [{ @@ -93,7 +96,7 @@ def get_charts(): "filters_json": json.dumps({ "period": "Monthly", "based_on": "Item", - "fiscal_year": fiscal_year, + "fiscal_year": fiscal_year_name, "company": company.name }), "is_custom": 1, @@ -108,14 +111,13 @@ def get_charts(): "chart_type": "Report", "custom_options": json.dumps({ "axisOptions": {"shortenYAxisNumbers": 1}, - "tooltipOptions": {}, - "colors":["#5e64ff"] + "tooltipOptions": {} }), "doctype": "Dashboard Chart", "filters_json": json.dumps({ "period": "Monthly", "based_on": "Item", - "fiscal_year": fiscal_year, + "fiscal_year": fiscal_year_name, "company": company.name, "period_based_on": "posting_date" }), @@ -151,7 +153,8 @@ def get_number_cards(): "document_type": "Purchase Receipt", "filters_json": json.dumps( [["Purchase Receipt","status","=","To Bill",False], - ["Purchase Receipt","company","=", company.name, False]] + ["Purchase Receipt","company","=", company.name, False], + ["Purchase Receipt", "posting_date", "Between", [start_date,end_date], False]] ), "is_public": 1, "owner": "Administrator", @@ -167,7 +170,8 @@ def get_number_cards(): "document_type": "Delivery Note", "filters_json": json.dumps( [["Delivery Note","company","=",company.name,False], - ["Delivery Note","status","=","To Bill",False]] + ["Delivery Note","status","=","To Bill",False], + ["Delivery Note", "posting_date", "Between", [start_date,end_date], False]] ), "is_public": 1, "owner": "Administrator", @@ -182,7 +186,8 @@ def get_number_cards(): "document_type": "Purchase Receipt", "filters_json": json.dumps( [["Purchase Receipt","status","=","To Bill",False], - ["Purchase Receipt","company","=", company.name, False]] + ["Purchase Receipt","company","=", company.name, False], + ["Purchase Receipt", "posting_date", "Between", [start_date,end_date], False]] ), "is_public": 1, "owner": "Administrator", @@ -197,7 +202,8 @@ def get_number_cards(): "document_type": "Delivery Note", "filters_json": json.dumps( [["Delivery Note","company","=",company.name,False], - ["Delivery Note","status","=","To Bill",False]] + ["Delivery Note","status","=","To Bill",False], + ["Delivery Note", "posting_date", "Between", [start_date,end_date], False]] ), "is_public": 1, "owner": "Administrator",