I wish to print the territory name in the “Address” print format for customer. I tried to use
{{ doc.customer.territory }}
but it throws error in the print. Please help me with how to get data from linked customer form?
OR simply put, How to access data using the Link type fields
rmehta
March 10, 2015, 6:53am
2
try:
{{ frappe.db.get_value("Customer", doc.customer, "territory") }}
1 Like
Thanks. It worked just as I wanted.
I also wish to now print
the time of printing (the server time, current at the time of generating the PDF/rendering the print format)
The name of the user who is logged in and issued the print (the user with current session)
If possible, please guide me where can i find the list of all such globally accessible data
Idea: I am trying to build a print format for envelop printing
I tried frappe.utils.data.now() but it fails to render
I was able to print the date and time of client machine using JS. I’d still prefer if I can get server timestamp somehow
rmehta
March 23, 2015, 9:10am
7
try frappe.utils.now()
List of available functions in Print Formats:
text_content = None
return (message, text_content)
def validate_template(html):
"""Throws exception if there is a syntax error in the Jinja Template"""
from jinja2 import TemplateSyntaxError
import frappe
if not html:
return
jenv = get_jenv()
try:
jenv.from_string(html)
except TemplateSyntaxError as e:
frappe.msgprint(f"Line {e.lineno}: {e.message}")
frappe.throw(frappe._("Syntax error in template"))