fix: Add button to create pick list from material request

This commit is contained in:
Suraj Shetty 2019-08-26 08:38:37 +05:30
parent a1dc152695
commit be9f4ea487
2 changed files with 17 additions and 1 deletions

View File

@ -55,13 +55,19 @@ frappe.ui.form.on('Material Request', {
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 @@ frappe.ui.form.on('Material Request', {
});
},
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",

View File

@ -508,6 +508,9 @@ def create_pick_list(source_name, target_doc=None):
doc = get_mapped_doc('Material Request', source_name, {
'Material Request': {
'doctype': 'Pick List',
'field_map': {
'material_request_type': 'purpose'
},
'validation': {
'docstatus': ['=', 1]
}