fix: Date filters added to dashboards, number cards and minor fixes.

This commit is contained in:
marination
2020-05-19 17:02:47 +05:30
parent 75c65fd1b1
commit 50d4bf578b
3 changed files with 18 additions and 10 deletions

View File

@@ -34,10 +34,10 @@ def get_dashboards():
"name": "Buying", "name": "Buying",
"dashboard_name": "Buying", "dashboard_name": "Buying",
"charts": [ "charts": [
{ "chart": "Top Suppliers", "width": "Full"}, { "chart": "Purchase Order Trends", "width": "Full"},
{ "chart": "Material Request Analysis", "width": "Half"}, { "chart": "Material Request Analysis", "width": "Half"},
{ "chart": "Purchase Order Analysis", "width": "Half"}, { "chart": "Purchase Order Analysis", "width": "Half"},
{ "chart": "Purchase Order Trends", "width": "Full"} { "chart": "Top Suppliers", "width": "Full"}
], ],
"cards": [ "cards": [
{ "card": "Purchase Orders to Receive"}, { "card": "Purchase Orders to Receive"},
@@ -80,7 +80,8 @@ def get_charts():
"filters_json": json.dumps( "filters_json": json.dumps(
[["Material Request", "status", "not in", ["Draft", "Cancelled", "Stopped", None], False], [["Material Request", "status", "not in", ["Draft", "Cancelled", "Stopped", None], False],
["Material Request", "material_request_type", "=", "Purchase", False], ["Material Request", "material_request_type", "=", "Purchase", False],
["Material Request", "company", "=", company.name, False]] ["Material Request", "company", "=", company.name, False],
["Material Request", "transaction_date", "Between", [start_date,end_date], False]]
), ),
"group_by_based_on": "status", "group_by_based_on": "status",
"group_by_type": "Count", "group_by_type": "Count",
@@ -96,9 +97,11 @@ def get_charts():
"chart_type": "Report", "chart_type": "Report",
"custom_options": json.dumps({ "custom_options": json.dumps({
"type": "line", "type": "line",
"regionFill": 1,
"axisOptions": {"shortenYAxisNumbers": 1}, "axisOptions": {"shortenYAxisNumbers": 1},
"tooltipOptions": {} "tooltipOptions": {},
"lineOptions": {
"regionFill": 1
}
}), }),
"doctype": "Dashboard Chart", "doctype": "Dashboard Chart",
"filters_json": json.dumps({ "filters_json": json.dumps({
@@ -144,7 +147,8 @@ def get_number_cards():
"filters_json": json.dumps( "filters_json": json.dumps(
[["Purchase Order", "transaction_date", "Between", [start_date,end_date], False], [["Purchase Order", "transaction_date", "Between", [start_date,end_date], False],
["Purchase Order", "status", "not in", ["Draft","On Hold","Cancelled","Closed", None], False], ["Purchase Order", "status", "not in", ["Draft","On Hold","Cancelled","Closed", None], False],
["Purchase Order", "company", "=", company.name, False]] ["Purchase Order", "company", "=", company.name, False],
["Purchase Order", "transaction_date", "Between", [start_date,end_date], False]]
), ),
"function": "Sum", "function": "Sum",
"is_public": 1, "is_public": 1,
@@ -159,7 +163,8 @@ def get_number_cards():
"document_type": "Purchase Order", "document_type": "Purchase Order",
"filters_json": json.dumps( "filters_json": json.dumps(
[["Purchase Order", "status", "in", ["To Receive and Bill", "To Receive", None], False], [["Purchase Order", "status", "in", ["To Receive and Bill", "To Receive", None], False],
["Purchase Order", "company", "=", company.name, False]] ["Purchase Order", "company", "=", company.name, False],
["Purchase Order", "transaction_date", "Between", [start_date,end_date], False]]
), ),
"function": "Count", "function": "Count",
"is_public": 1, "is_public": 1,

View File

@@ -19,7 +19,7 @@
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/buying", "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/buying",
"idx": 0, "idx": 0,
"is_complete": 0, "is_complete": 0,
"modified": "2020-05-15 23:42:35.625736", "modified": "2020-05-19 15:37:50.111851",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Buying", "name": "Buying",

View File

@@ -46,10 +46,13 @@ def get_chart_data(data, conditions, filters):
"labels" : labels, "labels" : labels,
"datasets" : [ "datasets" : [
{ {
"name" : _("{0}").format(filters.get("period")) + _(" Revenue"), "name" : _("{0}").format(filters.get("period")) + _(" Expenditure"),
"values" : datapoints "values" : datapoints
} }
] ]
}, },
"type" : "line" "type" : "line",
"lineOptions": {
"regionFill": 1
}
} }