mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-25 09:38:31 +00:00
fix: handle html email template separately in RFQ to avoid jinja context error
(cherry picked from commit 49d363b174)
# Conflicts:
# erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
This commit is contained in:
committed by
Mergify
parent
86f8bd403d
commit
90169a39bb
@@ -250,10 +250,17 @@ frappe.ui.form.on("Request for Quotation", {
|
|||||||
"subject",
|
"subject",
|
||||||
])
|
])
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
frm.set_value(
|
if (r.message.use_html) {
|
||||||
"message_for_supplier",
|
frm.set_value({
|
||||||
r.message.use_html ? r.message.response_html : r.message.response
|
mfs_html: r.message.response_html,
|
||||||
);
|
use_html: 1,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
frm.set_value({
|
||||||
|
message_for_supplier: r.message.response,
|
||||||
|
use_html: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
frm.set_value("subject", r.message.subject);
|
frm.set_value("subject", r.message.subject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,9 @@
|
|||||||
"send_document_print",
|
"send_document_print",
|
||||||
"sec_break_email_2",
|
"sec_break_email_2",
|
||||||
"subject",
|
"subject",
|
||||||
|
"use_html",
|
||||||
"message_for_supplier",
|
"message_for_supplier",
|
||||||
|
"mfs_html",
|
||||||
"terms_section_break",
|
"terms_section_break",
|
||||||
"incoterm",
|
"incoterm",
|
||||||
"named_place",
|
"named_place",
|
||||||
@@ -142,12 +144,13 @@
|
|||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"default": "Please supply the specified items at the best possible rates",
|
"default": "Please supply the specified items at the best possible rates",
|
||||||
|
"depends_on": "eval:doc.use_html == 0",
|
||||||
"fieldname": "message_for_supplier",
|
"fieldname": "message_for_supplier",
|
||||||
"fieldtype": "Text Editor",
|
"fieldtype": "Text Editor",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Message for Supplier",
|
"label": "Message for Supplier",
|
||||||
"print_hide": 1,
|
"mandatory_depends_on": "eval:doc.use_html == 0",
|
||||||
"reqd": 1
|
"print_hide": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
@@ -324,6 +327,22 @@
|
|||||||
"label": "Subject",
|
"label": "Subject",
|
||||||
"not_nullable": 1,
|
"not_nullable": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 1,
|
||||||
|
"depends_on": "eval:doc.use_html == 1",
|
||||||
|
"fieldname": "mfs_html",
|
||||||
|
"fieldtype": "Code",
|
||||||
|
"label": "Message for Supplier",
|
||||||
|
"mandatory_depends_on": "eval:doc.use_html == 1",
|
||||||
|
"print_hide": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "use_html",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Use HTML"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"grid_page_length": 50,
|
"grid_page_length": 50,
|
||||||
@@ -331,7 +350,11 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
|
<<<<<<< HEAD
|
||||||
"modified": "2026-01-05 14:27:33.329810",
|
"modified": "2026-01-05 14:27:33.329810",
|
||||||
|
=======
|
||||||
|
"modified": "2026-03-01 23:38:48.079274",
|
||||||
|
>>>>>>> 49d363b174 (fix: handle html email template separately in RFQ to avoid jinja context error)
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Request for Quotation",
|
"name": "Request for Quotation",
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ class RequestforQuotation(BuyingController):
|
|||||||
incoterm: DF.Link | None
|
incoterm: DF.Link | None
|
||||||
items: DF.Table[RequestforQuotationItem]
|
items: DF.Table[RequestforQuotationItem]
|
||||||
letter_head: DF.Link | None
|
letter_head: DF.Link | None
|
||||||
message_for_supplier: DF.TextEditor
|
message_for_supplier: DF.TextEditor | None
|
||||||
|
mfs_html: DF.Code | None
|
||||||
named_place: DF.Data | None
|
named_place: DF.Data | None
|
||||||
naming_series: DF.Literal["PUR-RFQ-.YYYY.-"]
|
naming_series: DF.Literal["PUR-RFQ-.YYYY.-"]
|
||||||
opportunity: DF.Link | None
|
opportunity: DF.Link | None
|
||||||
@@ -61,6 +62,7 @@ class RequestforQuotation(BuyingController):
|
|||||||
tc_name: DF.Link | None
|
tc_name: DF.Link | None
|
||||||
terms: DF.TextEditor | None
|
terms: DF.TextEditor | None
|
||||||
transaction_date: DF.Date
|
transaction_date: DF.Date
|
||||||
|
use_html: DF.Check
|
||||||
vendor: DF.Link | None
|
vendor: DF.Link | None
|
||||||
# end: auto-generated types
|
# end: auto-generated types
|
||||||
|
|
||||||
@@ -100,8 +102,16 @@ class RequestforQuotation(BuyingController):
|
|||||||
["use_html", "response", "response_html", "subject"],
|
["use_html", "response", "response_html", "subject"],
|
||||||
as_dict=True,
|
as_dict=True,
|
||||||
)
|
)
|
||||||
if not self.message_for_supplier:
|
|
||||||
self.message_for_supplier = data.response_html if data.use_html else data.response
|
self.use_html = data.use_html
|
||||||
|
|
||||||
|
if data.use_html:
|
||||||
|
if not self.mfs_html:
|
||||||
|
self.mfs_html = data.response_html
|
||||||
|
else:
|
||||||
|
if not self.message_for_supplier:
|
||||||
|
self.message_for_supplier = data.response
|
||||||
|
|
||||||
if not self.subject:
|
if not self.subject:
|
||||||
self.subject = data.subject
|
self.subject = data.subject
|
||||||
|
|
||||||
@@ -304,7 +314,10 @@ class RequestforQuotation(BuyingController):
|
|||||||
else:
|
else:
|
||||||
sender = frappe.session.user not in STANDARD_USERS and frappe.session.user or None
|
sender = frappe.session.user not in STANDARD_USERS and frappe.session.user or None
|
||||||
|
|
||||||
rendered_message = frappe.render_template(self.message_for_supplier, doc_args)
|
message_template = self.mfs_html if self.use_html else self.message_for_supplier
|
||||||
|
# nosemgrep: frappe-semgrep-rules.rules.security.frappe-ssti
|
||||||
|
rendered_message = frappe.render_template(message_template, doc_args)
|
||||||
|
|
||||||
subject_source = (
|
subject_source = (
|
||||||
self.subject
|
self.subject
|
||||||
or frappe.get_value("Email Template", self.email_template, "subject")
|
or frappe.get_value("Email Template", self.email_template, "subject")
|
||||||
|
|||||||
Reference in New Issue
Block a user