From 41c4d19279d20b141f725dda89e45c57b6c8374b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 6 Aug 2012 18:22:59 +0530 Subject: [PATCH] added button to make Purchase Order from Supplier Quotation --- .../supplier_quotation/supplier_quotation.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index 4d2673c5ef..430d1eed99 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -47,13 +47,17 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { } } -cur_frm.cscript.toggle_contact_section = function(doc) { - console.log(doc.supplier); - doc.supplier ? unhide_field("contact_section") : hide_field("contact_section"); -} - -cur_frm.cscript.make_purchase_order = function(doc, dt, dn) { - +cur_frm.cscript.make_purchase_order = function() { + var new_po_name = createLocal("Purchase Order"); + $c("dt_map", { + "docs": compress_doclist([locals['Purchase Order'][new_po_name]]), + "from_doctype": cur_frm.doc.doctype, + "to_doctype": "Purchase Order", + "from_docname": cur_frm.doc.name, + "from_to_list": JSON.stringify([['Supplier Quotation', 'Purchase Order'], + ['Supplier Quotation Item', 'Purchase Order Item'], + ['Purchase Taxes and Charges', 'Purchase Taxes and Charges']]), + }, function(r, rt) { loaddoc("Purchase Order", new_po_name) }); } cur_frm.cscript.supplier = function(doc, dt, dn) { @@ -65,6 +69,10 @@ cur_frm.cscript.supplier = function(doc, dt, dn) { } } +cur_frm.cscript.uom = function(doc, cdt, cdn) { + // no need to trigger updation of stock uom, as this field doesn't exist in supplier quotation +} + cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) { return "select `tabProject`.name from `tabProject` \ @@ -82,7 +90,6 @@ cur_frm.fields_dict['indent_no'].get_query = function(doc) { order by `tabPurchase Request`.`name` desc limit 50"; } - cur_frm.cscript.supplier_address = function(doc, dt, dn) { if (doc.supplier) { get_server_fields("get_supplier_address", JSON.stringify({supplier: doc.supplier,