fix: Add option to get items from work order
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js
index 22613cc..a42fc65 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.js
+++ b/erpnext/manufacturing/doctype/work_order/work_order.js
@@ -161,6 +161,10 @@
 			frm.add_custom_button(__('Create BOM'), () => {
 				frm.trigger("make_bom");
 			});
+
+			frm.add_custom_button(__('Pick List'), () => {
+				frm.trigger("make_bom");
+			}, __('Make'));
 		}
 	},
 
@@ -264,6 +268,10 @@
 		});
 	},
 
+	make_pick_list() {
+
+	},
+
 	show_progress: function(frm) {
 		var bars = [];
 		var message = '';
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 2b70325..c489fbc 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -19,6 +19,7 @@
 from frappe.utils.csvutils import getlink
 from erpnext.stock.utils import get_bin, validate_warehouse_company, get_latest_stock_qty
 from erpnext.utilities.transaction_base import validate_uom_is_integer
+from frappe.model.mapper import get_mapped_doc
 
 class OverProductionError(frappe.ValidationError): pass
 class StockOverProductionError(frappe.ValidationError): pass
@@ -707,3 +708,26 @@
 	for d in work_order.operations:
 		if d.operation == operation and d.workstation == workstation:
 			return d
+
+@frappe.whitelist()
+def make_pick_list(source_name, target_doc=None):
+	doc = get_mapped_doc("Work Order", source_name, {
+		"Work Order": {
+			"doctype": "Pick List",
+			"validation": {
+				"docstatus": ["=", 1]
+			}
+		},
+		"Work Order Item": {
+			"doctype": "Pick List Reference Item",
+			"field_map": {
+				"item_code": "item",
+				"required_qty": "qty",
+				"parenttype": "reference_doctype",
+				"parent": "reference_name",
+				"name": "reference_document_item"
+			},
+		},
+	}, target_doc)
+
+	return doc
diff --git a/erpnext/stock/doctype/pick_list/pick_list.js b/erpnext/stock/doctype/pick_list/pick_list.js
index 4cf4cdf..602b7e0 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.js
+++ b/erpnext/stock/doctype/pick_list/pick_list.js
@@ -14,13 +14,13 @@
 	},
 	refresh: (frm) => {
 		frm.add_custom_button(__('Delivery Note'), () => frm.trigger('make_delivery_note'), __('Create'));
-		frm.add_custom_button(__('Sales Order'), function() {
+		frm.add_custom_button(__('Sales Order'), () => {
 			erpnext.utils.map_current_doc({
 				method: "erpnext.selling.doctype.sales_order.sales_order.make_pick_list",
 				source_doctype: "Sales Order",
 				target: frm,
 				setters: {
-					company: frm.doc.company || undefined,
+					company: frm.doc.company,
 				},
 				get_query_filters: {
 					docstatus: 1,
@@ -28,6 +28,21 @@
 			});
 		}, __("Get items from"));
 
+		frm.add_custom_button(__('Work Order'), () => {
+			erpnext.utils.map_current_doc({
+				method: "erpnext.manufacturing.doctype.work_order.work_order.make_pick_list",
+				source_doctype: "Work Order",
+				target: frm,
+				setters: {
+					company: frm.doc.company,
+				},
+				date_field: 'creation',
+				get_query_filters: {
+					docstatus: 1,
+				}
+			});
+		}, __("Get items from"));
+
 		if (frm.doc.reference_items && frm.doc.reference_items.length) {
 			frm.add_custom_button(__('Get Item Locations'), () => {
 				frm.call('set_item_locations');
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 3e45bdd..77dacd5 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -97,7 +97,6 @@
 		'item_code': item_doc.item,
 		'warehouse': item_doc.warehouse,
 	}, as_dict=1)
-	print(batches)
 
 	required_qty = item_doc.qty
 	while required_qty > 0 and batches:
@@ -114,8 +113,8 @@
 			# split item if quantity of item in batch is less that required
 			# Look for another batch
 
-			# set quantity of of item equal to batch quantity
 			required_qty -= batch.qty
+			# set quantity of current item equal to batch quantity
 			item_doc.set('qty', batch.qty)
 			item_doc = parent_doc.append('items', {
 				'item': item_doc.item,