[ Enhance ] Production to Work Order (#12902)

* remove occurrences of Production Order

* rename from report and jsons

* Change Production Order to Work Order

* change occurences of production order from other files

* resolve minor conflict issues and reports

* patch added

* codacy fix

* updated patches, leftover changes

* rename reports, rectify patches
diff --git a/erpnext/demo/user/manufacturing.py b/erpnext/demo/user/manufacturing.py
index 80d140a..496b011 100644
--- a/erpnext/demo/user/manufacturing.py
+++ b/erpnext/demo/user/manufacturing.py
@@ -7,7 +7,7 @@
 from frappe.utils.make_random import how_many
 from frappe.desk import query_report
 from erpnext.manufacturing.doctype.workstation.workstation import WorkstationHolidayError
-from erpnext.manufacturing.doctype.production_order.test_production_order import make_prod_order_test_record
+from erpnext.manufacturing.doctype.work_order.test_work_order import make_prod_order_test_record
 
 def work():
 	frappe.set_user(frappe.db.get_global('demo_manufacturing_user'))
@@ -21,13 +21,13 @@
 	ppt.purchase_request_for_warehouse = "Stores - WPL"
 	ppt.run_method("get_open_sales_orders")
 	ppt.run_method("get_items")
-	ppt.run_method("raise_production_orders")
+	ppt.run_method("raise_work_orders")
 	ppt.run_method("raise_material_requests")
 	frappe.db.commit()
 
-	# submit production orders
-	for pro in frappe.db.get_values("Production Order", {"docstatus": 0}, "name"):
-		b = frappe.get_doc("Production Order", pro[0])
+	# submit work orders
+	for pro in frappe.db.get_values("Work Order", {"docstatus": 0}, "name"):
+		b = frappe.get_doc("Work Order", pro[0])
 		b.wip_warehouse = "Work in Progress - WPL"
 		b.submit()
 		frappe.db.commit()
@@ -40,12 +40,12 @@
 
 	# stores -> wip
 	if random.random() < 0.3:
-		for pro in query_report.run("Open Production Orders")["result"][:how_many("Stock Entry for WIP")]:
+		for pro in query_report.run("Open Work Orders")["result"][:how_many("Stock Entry for WIP")]:
 			make_stock_entry_from_pro(pro[0], "Material Transfer for Manufacture")
 
 	# wip -> fg
 	if random.random() < 0.3:
-		for pro in query_report.run("Production Orders in Progress")["result"][:how_many("Stock Entry for FG")]:
+		for pro in query_report.run("Work Orders in Progress")["result"][:how_many("Stock Entry for FG")]:
 			make_stock_entry_from_pro(pro[0], "Manufacture")
 
 	for bom in frappe.get_all('BOM', fields=['item'], filters = {'with_operations': 1}):
@@ -57,7 +57,7 @@
 
 	# submit time logs
 	for timesheet in frappe.get_all("Timesheet", ["name"], {"docstatus": 0,
-		"production_order": ("!=", ""), "to_time": ("<", frappe.flags.current_date)}):
+		"work_order": ("!=", ""), "to_time": ("<", frappe.flags.current_date)}):
 		timesheet = frappe.get_doc("Timesheet", timesheet.name)
 		try:
 			timesheet.submit()
@@ -68,10 +68,10 @@
 			pass
 
 def make_stock_entry_from_pro(pro_id, purpose):
-	from erpnext.manufacturing.doctype.production_order.production_order import make_stock_entry
+	from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry
 	from erpnext.stock.stock_ledger import NegativeStockError
 	from erpnext.stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, \
-		DuplicateEntryForProductionOrderError, OperationsNotCompleteError
+		DuplicateEntryForWorkOrderError, OperationsNotCompleteError
 
 	try:
 		st = frappe.get_doc(make_stock_entry(pro_id, purpose))
@@ -83,6 +83,6 @@
 		frappe.db.commit()
 		st.submit()
 		frappe.db.commit()
-	except (NegativeStockError, IncorrectValuationRateError, DuplicateEntryForProductionOrderError,
+	except (NegativeStockError, IncorrectValuationRateError, DuplicateEntryForWorkOrderError,
 		OperationsNotCompleteError):
 		frappe.db.rollback()