Merge pull request #21957 from nabinhait/fix344

fix: label changed in production plan
diff --git a/erpnext/controllers/website_list_for_contact.py b/erpnext/controllers/website_list_for_contact.py
index ed37938..ecf041e 100644
--- a/erpnext/controllers/website_list_for_contact.py
+++ b/erpnext/controllers/website_list_for_contact.py
@@ -155,7 +155,7 @@
 		return frappe.db.exists(doctype, get_customer_filter(doc, customers))
 	elif suppliers:
 		fieldname = 'suppliers' if doctype == 'Request for Quotation' else 'supplier'
-		return frappe.db.exists(doctype, filters={
+		return frappe.db.exists(doctype, {
 			'name': doc.name,
 			fieldname: ["in", suppliers]
 		})
diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js
index ac144e2..668e981 100644
--- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js
+++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js
@@ -3,3 +3,31 @@
 
 frappe.ui.form.on('Manufacturing Settings', {
 });
+
+frappe.tour["Manufacturing Settings"] = [
+	{
+		fieldname: "material_consumption",
+		title: __("Allow Multiple Material Consumption"),
+		description: __("If ticked, multiple materials can be used for a single Work Order. This is useful if one or more time consuming products are being manufactured.")
+	},
+	{
+		fieldname: "backflush_raw_materials_based_on",
+		title: __("Backflush Raw Materials"),
+		description: __("The Stock Entry of type 'Manufacture' is known as backflush. Raw materials being consumed to manufacture finished goods is known as backflushing. <br><br> When creating Manufacture Entry, raw-material items are backflushed based on BOM of production item. If you want raw-material items to be backflushed based on Material Transfer entry made against that Work Order instead, then you can set it under this field.")
+	},
+	{
+		fieldname: "default_wip_warehouse",
+		title: __("Work In Progress Warehouse"),
+		description: __("This Warehouse will be auto-updated in the Work In Progress Warehouse field of Work Orders.")
+	},
+	{
+		fieldname: "default_fg_warehouse",
+		title: __("Finished Goods Warehouse"),
+		description: __("This Warehouse will be auto-updated in the Target Warehouse field of Work Order.")
+	},
+	{
+		fieldname: "update_bom_costs_automatically",
+		title: __("Update BOM Cost Automatically"),
+		description: __("If ticked, the BOM cost will be automatically updated based on Valuation Rate / Price List Rate / last purchase rate of raw materials.")
+	}
+];
\ No newline at end of file
diff --git a/erpnext/manufacturing/onboarding_step/explore_manufacturing_settings/explore_manufacturing_settings.json b/erpnext/manufacturing/onboarding_step/explore_manufacturing_settings/explore_manufacturing_settings.json
index 582aba4..7ef202e 100644
--- a/erpnext/manufacturing/onboarding_step/explore_manufacturing_settings/explore_manufacturing_settings.json
+++ b/erpnext/manufacturing/onboarding_step/explore_manufacturing_settings/explore_manufacturing_settings.json
@@ -1,5 +1,5 @@
 {
- "action": "Update Settings",
+ "action": "Show Form Tour",
  "creation": "2020-05-19 11:55:11.378374",
  "docstatus": 0,
  "doctype": "Onboarding Step",
@@ -8,7 +8,7 @@
  "is_mandatory": 0,
  "is_single": 1,
  "is_skipped": 0,
- "modified": "2020-05-19 12:12:28.145366",
+ "modified": "2020-05-26 20:28:03.558199",
  "modified_by": "Administrator",
  "name": "Explore Manufacturing Settings",
  "owner": "Administrator",
diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.js b/erpnext/manufacturing/report/job_card_summary/job_card_summary.js
index b7e3071..33953b1 100644
--- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.js
+++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.js
@@ -13,17 +13,38 @@
 			reqd: 1
 		},
 		{
-			label: __("From Date"),
+			fieldname: "fiscal_year",
+			label: __("Fiscal Year"),
+			fieldtype: "Link",
+			options: "Fiscal Year",
+			default: frappe.defaults.get_user_default("fiscal_year"),
+			reqd: 1,
+			on_change: function(query_report) {
+				var fiscal_year = query_report.get_values().fiscal_year;
+				if (!fiscal_year) {
+					return;
+				}
+				frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
+					var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
+					frappe.query_report.set_filter_value({
+						from_date: fy.year_start_date,
+						to_date: fy.year_end_date
+					});
+				});
+			}
+		},
+		{
+			label: __("From Posting Date"),
 			fieldname:"from_date",
 			fieldtype: "Date",
-			default: frappe.datetime.add_months(frappe.datetime.get_today(), -12),
+			default: frappe.defaults.get_user_default("year_start_date"),
 			reqd: 1
 		},
 		{
-			label: __("To Date"),
+			label: __("To Posting Datetime"),
 			fieldname:"to_date",
 			fieldtype: "Date",
-			default: frappe.datetime.get_today(),
+			default: frappe.defaults.get_user_default("year_end_date"),
 			reqd: 1,
 		},
 		{
diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
index ae1e4f3..953d820 100644
--- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
+++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
@@ -15,9 +15,12 @@
 	return columns, data, None, chart_data
 
 def get_data(filters):
-	query_filters = {"docstatus": ("<", 2)}
+	query_filters = {
+		"docstatus": ("=", 1),
+		"posting_date": ("between", [filters.from_date, filters.to_date])
+	}
 
-	fields = ["name", "status", "work_order", "production_item", "item_name",
+	fields = ["name", "status", "work_order", "production_item", "item_name", "posting_date",
 		"total_completed_qty", "workstation", "operation", "employee_name", "total_time_in_mins"]
 
 	for field in ["work_order", "workstation", "operation", "company"]:
@@ -30,12 +33,19 @@
 	if not data: return []
 
 	job_cards = [d.name for d in data]
+
+	job_card_time_filter = {
+		"docstatus": 1,
+		"parent": ("in", job_cards),
+	}
+
 	job_card_time_details = {}
 	for job_card_data in frappe.get_all("Job Card Time Log",
 		fields=["min(from_time) as from_time", "max(to_time) as to_time", "parent"],
-		filters={"docstatus": ("<", 2), "parent": ("in", job_cards)}, group_by="parent"):
+		filters=job_card_time_filter, group_by="parent", debug=1):
 		job_card_time_details[job_card_data.parent] = job_card_data
 
+	res = []
 	for d in data:
 		if d.status == "Material Transferred":
 			d.status = "Open"
@@ -43,8 +53,9 @@
 		if job_card_time_details.get(d.name):
 			d.from_time = job_card_time_details.get(d.name).from_time
 			d.to_time = job_card_time_details.get(d.name).to_time
+			res.append(d)
 
-	return data
+	return res
 
 def get_chart_data(job_card_details, filters):
 	labels, periodic_data = prepare_chart_data(job_card_details, filters)
@@ -86,10 +97,10 @@
 			labels.append(period)
 
 		for d in job_card_details:
-			if getdate(d.from_time) >= from_date and getdate(d.to_time) <= end_date:
+			if getdate(d.posting_date) > from_date and getdate(d.posting_date) <= end_date:
 				status = "Completed" if d.status == "Completed" else "Pending"
 
-				if periodic_data.get(status) and periodic_data.get(status).get(period):
+				if periodic_data.get(status).get(period):
 					periodic_data[status][period] += 1
 				else:
 					periodic_data[status][period] = 1
@@ -105,6 +116,12 @@
 			"options": "Job Card",
 			"width": 100
 		},
+		{
+			"label": _("Posting Date"),
+			"fieldname": "posting_date",
+			"fieldtype": "Date",
+			"width": 100
+		},
 	]
 
 	if not filters.get("status"):
diff --git a/erpnext/manufacturing/report/work_order_summary/work_order_summary.js b/erpnext/manufacturing/report/work_order_summary/work_order_summary.js
index ec9fe35..2292865 100644
--- a/erpnext/manufacturing/report/work_order_summary/work_order_summary.js
+++ b/erpnext/manufacturing/report/work_order_summary/work_order_summary.js
@@ -13,17 +13,38 @@
 			reqd: 1
 		},
 		{
-			label: __("From Date"),
+			fieldname: "fiscal_year",
+			label: __("Fiscal Year"),
+			fieldtype: "Link",
+			options: "Fiscal Year",
+			default: frappe.defaults.get_user_default("fiscal_year"),
+			reqd: 1,
+			on_change: function(query_report) {
+				var fiscal_year = query_report.get_values().fiscal_year;
+				if (!fiscal_year) {
+					return;
+				}
+				frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
+					var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
+					frappe.query_report.set_filter_value({
+						from_date: fy.year_start_date,
+						to_date: fy.year_end_date
+					});
+				});
+			}
+		},
+		{
+			label: __("From Posting Date"),
 			fieldname:"from_date",
 			fieldtype: "Date",
-			default: frappe.datetime.add_months(frappe.datetime.get_today(), -12),
+			default: frappe.defaults.get_user_default("year_start_date"),
 			reqd: 1
 		},
 		{
-			label: __("To Date"),
+			label: __("To Posting Datetime"),
 			fieldname:"to_date",
 			fieldtype: "Date",
-			default: frappe.datetime.get_today(),
+			default: frappe.defaults.get_user_default("year_end_date"),
 			reqd: 1,
 		},
 		{