[RFQ Enhancement] Added button on supplier row to download PDF for particular supplier
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 0826150..c6d04c1 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -2366,6 +2366,31 @@
   {
    "allow_on_submit": 0, 
    "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "language", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Print Language", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
    "collapsible": 1, 
    "fieldname": "more_info", 
    "fieldtype": "Section Break", 
@@ -3006,7 +3031,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-06-08 17:30:39.470490", 
+ "modified": "2016-06-30 13:40:39.440646", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice", 
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 f35c3b7..32a96bf 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -7,7 +7,7 @@
 cur_frm.add_fetch('contact', 'email_id', 'email_id')
 
 frappe.ui.form.on("Request for Quotation",{
-	setup: function(frm){
+	setup: function(frm) {
 		frm.fields_dict["suppliers"].grid.get_field("contact").get_query = function(doc, cdt, cdn){
 			var d =locals[cdt][cdn];
 			return {
@@ -29,7 +29,7 @@
 		];
 	},
 
-	onload: function(frm){
+	onload: function(frm) {
 		frm.add_fetch('standard_reply', 'response', 'response');
 
 		if(!frm.doc.message_for_supplier) {
@@ -37,7 +37,7 @@
 		}
 	},
 
-	refresh: function(frm, cdt, cdn){
+	refresh: function(frm, cdt, cdn) {
 		if (frm.doc.docstatus === 1) {
 			frm.add_custom_button(__("Make Supplier Quotation"),
 				function(){ frm.trigger("make_suppplier_quotation") });
@@ -54,7 +54,7 @@
 		}
 	},
 
-	make_suppplier_quotation: function(frm){
+	make_suppplier_quotation: function(frm) {
 		var doc = frm.doc;
 		var dialog = new frappe.ui.Dialog({
 			title: __("For Supplier"),
@@ -93,10 +93,24 @@
 })
 
 frappe.ui.form.on("Request for Quotation Supplier",{
-	supplier: function(frm, cdt, cdn){
+	supplier: function(frm, cdt, cdn) {
 		var d = locals[cdt][cdn]
 		frappe.model.set_value(cdt, cdn, 'contact', '')
 		frappe.model.set_value(cdt, cdn, 'email_id', '')
+	},
+
+	download_pdf: function(frm, cdt, cdn) {
+		var child = locals[cdt][cdn]
+
+		var w = window.open(
+			frappe.urllib.get_full_url("/api/method/erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_pdf?"
+			+"doctype="+encodeURIComponent(frm.doc.doctype)
+			+"&name="+encodeURIComponent(frm.doc.name)
+			+"&supplier_idx="+encodeURIComponent(child.idx)
+			+"&no_letterhead=0"));
+		if(!w) {
+			msgprint(__("Please enable pop-ups")); return;
+		}
 	}
 })
 
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
index ddf2c8c..67ad3c2 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -6,8 +6,9 @@
 import frappe, json
 from frappe import _
 from frappe.model.mapper import get_mapped_doc
-from frappe.utils import get_url, random_string
+from frappe.utils import get_url, random_string, cint
 from frappe.utils.user import get_user_fullname
+from frappe.utils.print_format import download_pdf
 from frappe.desk.form.load import get_attachments
 from frappe.core.doctype.communication.email import make
 from erpnext.accounts.party import get_party_account_currency, get_party_details
@@ -136,15 +137,20 @@
 
 	def get_attachments(self):
 		attachments = [d.name for d in get_attachments(self.doctype, self.name)]
-		attachments.append(frappe.attach_print('Request for Quotation', self.name, doc=self))
+		attachments.append(frappe.attach_print(self.doctype, self.name, doc=self))
 		return attachments
 
 @frappe.whitelist()
 def send_supplier_emails(rfq_name):
+	check_portal_enabled('Request for Quotation')
 	rfq = frappe.get_doc("Request for Quotation", rfq_name)
 	if rfq.docstatus==1:
 		rfq.send_to_supplier()
 
+def check_portal_enabled(reference_doctype):
+	if not frappe.db.get_value('Portal Menu Item',
+		{'reference_doctype': reference_doctype}, 'enabled'):
+		frappe.throw(_("Request for Quotation is disabled to access from portal, for more check portal settings."))
 
 def get_list_context(context=None):
 	from erpnext.controllers.website_list_for_contact import get_list_context
@@ -152,7 +158,6 @@
 	list_context["show_sidebar"] = True
 	return list_context
 
-
 # This method is used to make supplier quotation from material request form.
 @frappe.whitelist()
 def make_supplier_quotation(source_name, for_supplier, target_doc=None):
@@ -226,3 +231,16 @@
 		"request_for_quotation_item": data.name,
 		"request_for_quotation": data.parent
 	})
+
+@frappe.whitelist()
+def get_pdf(doctype, name, supplier_idx):
+	doc = get_rfq_doc(doctype, name, supplier_idx)
+	if doc:
+		download_pdf(doctype, name, doc=doc)
+
+def get_rfq_doc(doctype, name, supplier_idx):
+	if cint(supplier_idx):
+		doc = frappe.get_doc(doctype, name)
+		args = doc.get('suppliers')[cint(supplier_idx) - 1]
+		doc.update_supplier_part_no(args)
+		return doc
\ No newline at end of file
diff --git a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json
index 5fe7456..bfd5ec1 100644
--- a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json
+++ b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json
@@ -162,6 +162,31 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "download_pdf", 
+   "fieldtype": "Button", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Download PDF", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "hide_heading": 0, 
@@ -174,7 +199,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-06-30 02:01:54.130809", 
+ "modified": "2016-06-30 12:47:23.564189", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Request for Quotation Supplier", 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index 62ecee6..f10b634 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -2197,6 +2197,31 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "language", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Print Language", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
    "fieldname": "other_details", 
    "fieldtype": "HTML", 
    "hidden": 1, 
@@ -2419,7 +2444,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-06-09 15:11:04.042369", 
+ "modified": "2016-06-30 13:42:23.310309", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt",