From 5f5f0bec2cd33c7391b48aa98dce855eb9912447 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 30 Jun 2016 17:02:37 +0530 Subject: [PATCH] [fix] buttons for rfq and material request --- .../request_for_quotation.js | 10 +++++-- .../material_request/material_request.js | 14 +++++++++ erpnext/templates/pages/demo.html | 29 ++++++++++++++++++- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js index 32a96bf785f..726f767ddd6 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js @@ -21,7 +21,7 @@ frappe.ui.form.on("Request for Quotation",{ {fieldname: 'schedule_date', columns: 2}, {fieldname: 'warehouse', columns: 3}, ]; - + frm.get_field('suppliers').grid.editable_fields = [ {fieldname: 'supplier', columns: 4}, {fieldname: 'contact', columns: 3}, @@ -39,8 +39,12 @@ frappe.ui.form.on("Request for Quotation",{ refresh: function(frm, cdt, cdn) { if (frm.doc.docstatus === 1) { - frm.add_custom_button(__("Make Supplier Quotation"), - function(){ frm.trigger("make_suppplier_quotation") }); + frm.add_custom_button(__("Make"), + function(){ frm.trigger("make_suppplier_quotation") }, __("Supplier Quotation")); + + frm.add_custom_button(__("View"), + function(){ frappe.set_route('List', 'Supplier Quotation', + {'request_for_quotation': frm.doc.name}) }, __("Supplier Quotation")); frm.add_custom_button(__("Send Supplier Emails"), function() { frappe.call({ diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index 68ce231af2c..fea0d7ef94d 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -40,6 +40,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten }, refresh: function(doc) { + var me = this; this._super(); if(doc.docstatus==0) { @@ -75,6 +76,19 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten cur_frm.add_custom_button(__("Production Order"), this.raise_production_orders, __("Make")); + // show + + if(doc.material_request_type === "Purchase" && doc.docstatus==1) { + me.frm.add_custom_button(__("Request for Quotation"), + function() { frappe.set_route('List', 'Request for Quotation', + {'material_request': doc.name})}, __("Show")); + + me.frm.add_custom_button(__("Supplier Quotation"), + function() { frappe.set_route('List', 'Supplier Quotation', + {'material_request': doc.name})}, __("Show")); + + } + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); // stop diff --git a/erpnext/templates/pages/demo.html b/erpnext/templates/pages/demo.html index 23a9a2186f5..e1d98a11584 100644 --- a/erpnext/templates/pages/demo.html +++ b/erpnext/templates/pages/demo.html @@ -1,7 +1,34 @@ {% extends "templates/web.html" %} {% block script %} - + {% endblock %} {% block style %}