Merge pull request #31550 from marination/rfq-email-addressing

fix: Use Contact Name instead of Supplier in RFQ Email
This commit is contained in:
Marica 2022-07-11 11:21:17 +05:30 committed by GitHub
commit 18a8e3fd60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,12 +180,20 @@ 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
supplier_name = None
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.",
}