mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 15:11:52 +00:00
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
@@ -65,4 +65,6 @@ def get_shipping_address(company, address=None):
|
|||||||
if address:
|
if address:
|
||||||
address_as_dict = address[0]
|
address_as_dict = address[0]
|
||||||
name, address_template = get_address_templates(address_as_dict)
|
name, address_template = get_address_templates(address_as_dict)
|
||||||
return address_as_dict.get("name"), frappe.render_template(address_template, address_as_dict)
|
return address_as_dict.get("name"), frappe.render_template(
|
||||||
|
address_template, address_as_dict, restrict_globals=True
|
||||||
|
)
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ class PaymentRequest(Document):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.message:
|
if self.message:
|
||||||
return frappe.render_template(self.message, context)
|
return frappe.render_template(self.message, context, restrict_globals=True)
|
||||||
|
|
||||||
def set_failed(self):
|
def set_failed(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -325,14 +325,14 @@ class RequestforQuotation(BuyingController):
|
|||||||
|
|
||||||
message_template = self.mfs_html if self.use_html else self.message_for_supplier
|
message_template = self.mfs_html if self.use_html else self.message_for_supplier
|
||||||
# nosemgrep: frappe-semgrep-rules.rules.security.frappe-ssti
|
# nosemgrep: frappe-semgrep-rules.rules.security.frappe-ssti
|
||||||
rendered_message = frappe.render_template(message_template, doc_args)
|
rendered_message = frappe.render_template(message_template, doc_args, restrict_globals=True)
|
||||||
|
|
||||||
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")
|
||||||
or _("Request for Quotation")
|
or _("Request for Quotation")
|
||||||
)
|
)
|
||||||
rendered_subject = frappe.render_template(subject_source, doc_args)
|
rendered_subject = frappe.render_template(subject_source, doc_args, restrict_globals=True)
|
||||||
if preview:
|
if preview:
|
||||||
return {
|
return {
|
||||||
"message": rendered_message,
|
"message": rendered_message,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class ContractTemplate(Document):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if self.contract_terms:
|
if self.contract_terms:
|
||||||
validate_template(self.contract_terms)
|
validate_template(self.contract_terms, restrict_globals=True)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
@@ -42,6 +42,6 @@ def get_contract_template(template_name, doc):
|
|||||||
contract_terms = None
|
contract_terms = None
|
||||||
|
|
||||||
if contract_template.contract_terms:
|
if contract_template.contract_terms:
|
||||||
contract_terms = frappe.render_template(contract_template.contract_terms, doc)
|
contract_terms = frappe.render_template(contract_template.contract_terms, doc, restrict_globals=True)
|
||||||
|
|
||||||
return {"contract_template": contract_template, "contract_terms": contract_terms}
|
return {"contract_template": contract_template, "contract_terms": contract_terms}
|
||||||
|
|||||||
@@ -171,8 +171,8 @@ def send_mail(entry, email_campaign):
|
|||||||
context = {"doc": frappe.get_doc("Email Group", recipient)}
|
context = {"doc": frappe.get_doc("Email Group", recipient)}
|
||||||
|
|
||||||
# Render template
|
# Render template
|
||||||
subject = frappe.render_template(email_template.get("subject"), context)
|
subject = frappe.render_template(email_template.get("subject"), context, restrict_globals=True)
|
||||||
content = frappe.render_template(email_template.response_, context)
|
content = frappe.render_template(email_template.response_, context, restrict_globals=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
comm = make(
|
comm = make(
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ def notify_customers(delivery_trip):
|
|||||||
frappe.sendmail(
|
frappe.sendmail(
|
||||||
recipients=contact_info.email_id,
|
recipients=contact_info.email_id,
|
||||||
subject=dispatch_template.subject,
|
subject=dispatch_template.subject,
|
||||||
message=frappe.render_template(dispatch_template.response, context),
|
message=frappe.render_template(dispatch_template.response, context, restrict_globals=True),
|
||||||
attachments=get_attachments(stop),
|
attachments=get_attachments(stop),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user