mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-21 18:29:57 +00:00
fix(tnc): using get_cached_doc to retrieve template for get_terms_and_conditions and permission checks (#57096)
This commit is contained in:
@@ -39,7 +39,10 @@ class TermsandConditions(Document):
|
||||
def get_terms_and_conditions(template_name: str, doc: str | dict):
|
||||
doc = frappe.parse_json(doc)
|
||||
|
||||
terms = frappe.get_cached_value("Terms and Conditions", template_name, "terms")
|
||||
tnc = frappe.get_cached_doc("Terms and Conditions", template_name)
|
||||
tnc.check_permission()
|
||||
|
||||
if terms:
|
||||
return frappe.render_template(terms, doc, restrict_globals=True)
|
||||
if not tnc.terms:
|
||||
return
|
||||
|
||||
return frappe.render_template(tnc.terms, doc, restrict_globals=True)
|
||||
|
||||
Reference in New Issue
Block a user