From 6ea82c07fe560bf9fc1b2988e26f946faaa4f856 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 6 Aug 2012 18:27:58 +0530 Subject: [PATCH] added button, method in Purchase Request form to make Supplier Quotation --- .../purchase_request/purchase_request.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_request/purchase_request.js b/erpnext/buying/doctype/purchase_request/purchase_request.js index c29434dee20..733da5260ca 100644 --- a/erpnext/buying/doctype/purchase_request/purchase_request.js +++ b/erpnext/buying/doctype/purchase_request/purchase_request.js @@ -51,10 +51,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.docstatus == 1 && doc.status != 'Stopped'){ if(doc.per_ordered < 100) { - cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']) - cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request']) + cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']); + cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request']); } cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); + cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation); } if(doc.docstatus == 1 && doc.status == 'Stopped') @@ -124,3 +125,15 @@ cur_frm.cscript['Unstop Purchase Request'] = function(){ }); } } + +cur_frm.cscript.make_supplier_quotation = function() { + var new_sq_name = createLocal("Supplier Quotation"); + $c("dt_map", { + "docs": compress_doclist([locals['Supplier Quotation'][new_sq_name]]), + "from_doctype": cur_frm.doc.doctype, + "to_doctype": "Supplier Quotation", + "from_docname": cur_frm.doc.name, + "from_to_list": JSON.stringify([['Purchase Request', 'Supplier Quotation'], + ['Purchase Request Item', 'Supplier Quotation Item']]), + }, function(r, rt) { loaddoc("Supplier Quotation", new_sq_name) }); +} \ No newline at end of file