fix: RFQ does not fetch html response

(cherry picked from commit da899913b8)
This commit is contained in:
Mihir Kandoi
2025-12-29 14:54:44 +05:30
committed by Mergify
parent d983280de8
commit 90e8090dcc
3 changed files with 27 additions and 4 deletions

View File

@@ -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"),

View File

@@ -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": []
}
}

View File

@@ -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)):