From e429e608c2ab9451bf307b46776563dc8a3d2a44 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 05:52:40 +0000 Subject: [PATCH] fix: pick correct name when creating user from RFQ (backport #55468) (#55471) Co-authored-by: Mihir Kandoi fix: pick correct name when creating user from RFQ (#55468) --- .../request_for_quotation/request_for_quotation.py | 11 ++++++++++- 1 file changed, 10 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 791dc3088bc..95b0ec8b389 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py @@ -6,6 +6,7 @@ import json import frappe from frappe import _ +from frappe.contacts.doctype.contact.contact import get_full_name from frappe.core.doctype.communication.email import make from frappe.desk.form.load import get_attachments from frappe.model.mapper import get_mapped_doc @@ -272,12 +273,20 @@ class RequestforQuotation(BuyingController): supplier_doc.save() def create_user(self, rfq_supplier, link): + contact_name = None + if rfq_supplier.contact: + name_fields = frappe.get_value( + "Contact", rfq_supplier.contact, ["first_name", "middle_name", "last_name"] + ) + if name_fields: + contact_name = get_full_name(*name_fields) + user = frappe.get_doc( { "doctype": "User", "send_welcome_email": 0, "email": rfq_supplier.email_id, - "first_name": rfq_supplier.supplier_name or rfq_supplier.supplier, + "first_name": contact_name or rfq_supplier.supplier_name or rfq_supplier.supplier, "user_type": "Website User", "redirect_url": link, }