fix: Add button to create pick list from material request
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 96e31ff..feaa413 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -55,13 +55,19 @@
if (frm.doc.docstatus == 1 && frm.doc.status != 'Stopped') {
if (flt(frm.doc.per_ordered, 2) < 100) {
- // make
+ let add_create_pick_list_button = () => {
+ frm.add_custom_button(__('Pick List'),
+ () => frm.events.create_pick_list(frm), __('Create'));
+ }
+
if (frm.doc.material_request_type === "Material Transfer") {
+ add_create_pick_list_button();
frm.add_custom_button(__("Transfer Material"),
() => frm.events.make_stock_entry(frm), __('Create'));
}
if (frm.doc.material_request_type === "Material Issue") {
+ add_create_pick_list_button();
frm.add_custom_button(__("Issue Material"),
() => frm.events.make_stock_entry(frm), __('Create'));
}
@@ -258,6 +264,13 @@
});
},
+ create_pick_list: (frm) => {
+ frappe.model.open_mapped_doc({
+ method: "erpnext.stock.doctype.material_request.material_request.create_pick_list",
+ frm: frm
+ });
+ },
+
raise_work_orders: function(frm) {
frappe.call({
method:"erpnext.stock.doctype.material_request.material_request.raise_work_orders",
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index a1cf2f2..7040d83 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -508,6 +508,9 @@
doc = get_mapped_doc('Material Request', source_name, {
'Material Request': {
'doctype': 'Pick List',
+ 'field_map': {
+ 'material_request_type': 'purpose'
+ },
'validation': {
'docstatus': ['=', 1]
}