From 88ac519b2439603a65b720f935887fd7287005be Mon Sep 17 00:00:00 2001 From: marination Date: Thu, 7 Jul 2022 16:59:23 +0530 Subject: [PATCH] fix: Use Contact Name instead of Supplier in RFQ Email --- .../request_for_quotation/request_for_quotation.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 67affe770f..2fda831d75 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py @@ -180,12 +180,19 @@ class RequestforQuotation(BuyingController): doc_args = self.as_dict() doc_args.update({"supplier": data.get("supplier"), "supplier_name": data.get("supplier_name")}) + # Get Contact Full Name + if data.get("contact"): + contact_name = frappe.db.get_value( + "Contact", data.get("contact"), ["first_name", "middle_name", "last_name"] + ) + supplier_name = (" ").join(x for x in contact_name if x) # remove any blank values + args = { "update_password_link": update_password_link, "message": frappe.render_template(self.message_for_supplier, doc_args), "rfq_link": rfq_link, "user_fullname": full_name, - "supplier_name": data.get("supplier_name"), + "supplier_name": supplier_name or data.get("supplier_name"), "supplier_salutation": self.salutation or "Dear Mx.", }