Added Quote Status to RFQ Suppliers with No Quote
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 558e072..6b37eda 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -138,7 +138,6 @@
dialog.show();
},
-
make_suppplier_quotation: function(frm) {
var doc = frm.doc;
var dialog = new frappe.ui.Dialog({
@@ -207,6 +206,30 @@
if(!w) {
frappe.msgprint(__("Please enable pop-ups")); return;
}
+ },
+ no_quote: function(frm, cdt, cdn) {
+ var d = locals[cdt][cdn];
+ if (d.no_quote) {
+ if (d.quote_status != __('Received')) {
+ frappe.model.set_value(cdt, cdn, 'quote_status', 'No Quote');
+ } else {
+ frappe.msgprint(__("Cannot set a received RFQ to No Quote"));
+ frappe.model.set_value(cdt, cdn, 'no_quote', 0);
+ }
+ } else {
+ d.quote_status = __('Pending');
+ frm.call({
+ method:"update_rfq_supplier_status",
+ doc: frm.doc,
+ args: {
+ sup_name: d.supplier
+ },
+ callback: function(r) {
+ frm.refresh_field("suppliers");
+ }
+ });
+ }
+
}
})
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 e9603fb..a8e897c 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -54,6 +54,7 @@
frappe.db.set(self, 'status', 'Submitted')
for supplier in self.suppliers:
supplier.email_sent = 0
+ supplier.quote_status = 'Pending'
def on_cancel(self):
frappe.db.set(self, 'status', 'Cancelled')
@@ -157,6 +158,27 @@
attachments.append(frappe.attach_print(self.doctype, self.name, doc=self))
return attachments
+ def update_rfq_supplier_status(self, sup_name=None):
+ for supplier in self.suppliers:
+ if sup_name != None and supplier.supplier == sup_name:
+ if supplier.quote_status != _('No Quote'):
+ quote_status = _('Received')
+ for item in self.items:
+ sqi_count = frappe.db.sql("""
+ SELECT
+ COUNT(sqi.name) as count
+ FROM
+ `tabSupplier Quotation Item` as sqi,
+ `tabSupplier Quotation` as sq
+ WHERE sq.supplier = %(supplier)s
+ AND sqi.docstatus = 1
+ AND sqi.request_for_quotation_item = %(rqi)s
+ AND sqi.parent = sq.name""", {"supplier": supplier.supplier, "rqi": item.name}, as_dict=1)[0]
+ if (sqi_count.count) == 0:
+ quote_status = _('Pending')
+ supplier.quote_status = quote_status
+
+
@frappe.whitelist()
def send_supplier_emails(rfq_name):
check_portal_enabled('Request for Quotation')
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 a7c5a37..4babbe9 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
@@ -139,6 +139,69 @@
},
{
"allow_bulk_edit": 0,
+ "allow_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.docstatus >= 1 && doc.quote_status != 'Received'",
+ "fieldname": "no_quote",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "No Quote",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.docstatus >= 1 && !doc.no_quote",
+ "fieldname": "quote_status",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Quote Status",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pending\nReceived\nNo Quote",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -269,7 +332,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2017-07-24 06:52:19.542717",
+ "modified": "2017-07-26 22:25:58.096584",
"modified_by": "Administrator",
"module": "Buying",
"name": "Request for Quotation Supplier",
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
index 1cb5a18..5e17dce 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -31,9 +31,11 @@
def on_submit(self):
frappe.db.set(self, "status", "Submitted")
+ self.update_rfq_supplier_status(1)
def on_cancel(self):
frappe.db.set(self, "status", "Cancelled")
+ self.update_rfq_supplier_status(0)
def on_trash(self):
pass
@@ -50,6 +52,38 @@
"is_child_table": True
}
})
+ def update_rfq_supplier_status(self, include_me):
+ rfq_list = set([])
+ for item in self.items:
+ if item.request_for_quotation:
+ rfq_list.add(item.request_for_quotation)
+ for rfq in rfq_list:
+ doc = frappe.get_doc('Request for Quotation', rfq)
+ doc_sup = frappe.get_all('Request for Quotation Supplier', filters=
+ {'parent': doc.name, 'supplier': self.supplier}, fields=['name', 'quote_status'])[0]
+
+ quote_status = _('Received')
+ for item in doc.items:
+ sqi_count = frappe.db.sql("""
+ SELECT
+ COUNT(sqi.name) as count
+ FROM
+ `tabSupplier Quotation Item` as sqi,
+ `tabSupplier Quotation` as sq
+ WHERE sq.supplier = %(supplier)s
+ AND sqi.docstatus = 1
+ AND sq.name != %(me)s
+ AND sqi.request_for_quotation_item = %(rqi)s
+ AND sqi.parent = sq.name""", {"supplier": self.supplier, "rqi": item.name, 'me': self.name}, as_dict=1)[0]
+ self_count = sum(my_item.request_for_quotation_item == item.name for my_item in self.items) if include_me else 0
+ if (sqi_count.count + self_count) == 0:
+ quote_status = _('Pending')
+ if quote_status == _('Received') and doc_sup.quote_status == _('No Quote'):
+ frappe.msgprint(_("{0} indicates that {1} will not provide a quotation, but all items have been quoted. Updating the RFQ quote status.").format(doc.name, self.supplier))
+ frappe.db.set_value('Request for Quotation Supplier', doc_sup.name, 'quote_status', quote_status)
+ frappe.db.set_value('Request for Quotation Supplier', doc_sup.name, 'no_quote', 0)
+ elif doc_sup.quote_status != _('No Quote'):
+ frappe.db.set_value('Request for Quotation Supplier', doc_sup.name, 'quote_status', quote_status)
def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
diff --git a/erpnext/docs/user/manual/en/buying/request-for-quotation.md b/erpnext/docs/user/manual/en/buying/request-for-quotation.md
index 182c89d..a48c297 100644
--- a/erpnext/docs/user/manual/en/buying/request-for-quotation.md
+++ b/erpnext/docs/user/manual/en/buying/request-for-quotation.md
@@ -2,43 +2,40 @@
A Request for Quotation is a document that an organization submits to one or more suppliers eliciting quotation for items.
-In ERPNext, You can create request for quotation directly by going to:
+In ERPNext, You can create Request for Quotation directly by going to:
> Buying > Documents > Request for Quotation > New Request for Quotation
-
+After creation of Request for Quotation, there are two ways to generate Supplier Quotation from Request for Quotation.
-After creation of request for quotation, there are two ways to generate supplier quotation from request for quotation.
#### For User
-__Step 1:__ Open request for quotation and click on make supplier quotation.
+__Step 1:__ Open Request for Quotation and click on make Supplier Quotation.

-__Step 2:__ Select supplier and click on make supplier quotation.
+__Step 2:__ Select supplier and click on make Supplier Quotation.

-__Step 3:__ System will open the supplier quotation, user has to enter the rate and submit it.
+__Step 3:__ System will open the Supplier Quotation, user has to enter the rate and submit it.

#### For Supplier
-__Step 1:__ User has to create contact or enter Email Address against the supplier on request for quotation.
+__Step 1:__ User has to create contact or enter Email Address against the supplier on Request for Quotation.

__Step 2:__ User has to click on send supplier emails button.
-
-
-* If supplier's user not available: system will create supplier's user and send details to the supplier, supplier will need to click on the link(Password Update) present in the email. After password update supplier can access his portal with the request for quotation form.
+* If supplier's user not available: system will create supplier's user and send details to the supplier, supplier will need to click on the link(Password Update) present in the email. After password update supplier can access his portal with the Request for Quotation form.

-* If supplier's user available: system will send request for quotation link to supplier, supplier has to login using his credentials to view request for quotation form on portal.
+* If supplier's user available: system will send Request for Quotation link to supplier, supplier has to login using his credentials to view Request for Quotation form on portal.

@@ -46,9 +43,12 @@

-__Step 4:__ On submission, system will create supplier quotation(draft mode) against the supplier. User has to review the supplier quotation
- and submit it.
-
-More details:-
+__Step 4:__ On submission, system will create Supplier Quotation (draft mode) against the supplier. The user has to review the Supplier Quotation
+ and submit it. When all items from the Request for Quotation have been quoted by a supplier, the status is updated in the Supplier
+ table of the Request for Quotation.
-
\ No newline at end of file
+#### More details
+
+If a supplier indicates that they will not provide a quotation for the item, this can be indicated in the RFQ document by checking the 'No Quote' box after the Request for Quotation has been submitted.
+
+