From 90e8090dccf396ad72b5b219ca786ab592c4548e Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Mon, 29 Dec 2025 14:54:44 +0530 Subject: [PATCH] fix: RFQ does not fetch html response (cherry picked from commit da899913b8cd89c8c38cff9f60b761b4f88b97ea) --- .../request_for_quotation.js | 17 +++++++++++++++++ .../request_for_quotation.json | 6 ++---- .../request_for_quotation.py | 8 ++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) 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 6ab5048082e..5d57224cdc0 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js @@ -248,6 +248,23 @@ frappe.ui.form.on("Request for Quotation", { } refresh_field("items"); }, + + email_template(frm) { + if (frm.doc.email_template) { + frappe.db + .get_value("Email Template", frm.doc.email_template, [ + "use_html", + "response", + "response_html", + ]) + .then((r) => { + frm.set_value( + "message_for_supplier", + r.message.use_html ? r.message.response_html : r.message.response + ); + }); + } + }, preview: (frm) => { let dialog = new frappe.ui.Dialog({ title: __("Preview Email"), diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json index 824484f9c20..a7f7ee09434 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json @@ -139,8 +139,6 @@ }, { "allow_on_submit": 1, - "fetch_from": "email_template.response", - "fetch_if_empty": 1, "fieldname": "message_for_supplier", "fieldtype": "Text Editor", "in_list_view": 1, @@ -322,7 +320,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2025-03-03 16:48:39.856779", + "modified": "2025-12-29 14:44:18.934901", "modified_by": "Administrator", "module": "Buying", "name": "Request for Quotation", @@ -393,4 +391,4 @@ "sort_field": "modified", "sort_order": "DESC", "states": [] -} \ No newline at end of file +} 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 e8c5690cf6f..d8fcc45f9fd 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py @@ -66,6 +66,7 @@ class RequestforQuotation(BuyingController): def before_validate(self): self.set_has_unit_price_items() self.flags.allow_zero_qty = self.has_unit_price_items + self.set_message_for_supplier() def validate(self): self.validate_duplicate_supplier() @@ -90,6 +91,13 @@ class RequestforQuotation(BuyingController): not row.qty for row in self.get("items") if (row.item_code and not row.qty) ) + def set_message_for_supplier(self): + if self.email_template and not self.message_for_supplier: + data = frappe.get_value( + "Email Template", self.email_template, ["use_html", "response", "response_html"], as_dict=True + ) + self.message_for_supplier = data.response_html if data.use_html else data.response + def validate_duplicate_supplier(self): supplier_list = [d.supplier for d in self.suppliers] if len(supplier_list) != len(set(supplier_list)):