[Enhancement] Added supplier quotation link on rfq
diff --git a/erpnext/templates/pages/rfq.py b/erpnext/templates/pages/rfq.py
index decae41..abc2890 100644
--- a/erpnext/templates/pages/rfq.py
+++ b/erpnext/templates/pages/rfq.py
@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
+from frappe.utils import formatdate
from erpnext.controllers.website_list_for_contact import (get_customers_suppliers,
get_party_details)
@@ -13,6 +14,7 @@
context.doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name)
context.parents = frappe.form_dict.parents
context.doc.supplier = get_supplier()
+ context.doc.rfq_links = get_link_quotation(context.doc.supplier, context.doc.name)
unauthorized_user(context.doc.supplier)
update_supplier_details(context)
context["title"] = frappe.form_dict.name
@@ -41,4 +43,18 @@
context.doc.currency = supplier_doc.default_currency or frappe.db.get_value("Company", context.doc.company, "default_currency")
context.doc.currency_symbol = frappe.db.get_value("Currency", context.doc.currency, "symbol")
context.doc.number_format = frappe.db.get_value("Currency", context.doc.currency, "number_format")
- context.doc.buying_price_list = supplier_doc.default_price_list or ''
\ No newline at end of file
+ context.doc.buying_price_list = supplier_doc.default_price_list or ''
+
+def get_link_quotation(supplier, rfq):
+ quotation = frappe.db.sql(""" select distinct `tabSupplier Quotation Item`.parent as name,
+ `tabSupplier Quotation`.status, `tabSupplier Quotation`.transaction_date from
+ `tabSupplier Quotation Item`, `tabSupplier Quotation` where `tabSupplier Quotation`.docstatus < 2 and
+ `tabSupplier Quotation Item`.request_for_quotation =%(name)s and
+ `tabSupplier Quotation Item`.parent = `tabSupplier Quotation`.name and
+ `tabSupplier Quotation`.supplier = %(supplier)s order by `tabSupplier Quotation`.creation desc""",
+ {'name': rfq, 'supplier': supplier}, as_dict=1)
+
+ for data in quotation:
+ data.transaction_date = formatdate(data.transaction_date)
+
+ return quotation or None