Print Format in erpnext

ya in address there is no item.
I want to fetch list of Item from Item Doctype

Do you have any reference of item in Address Template.
What is your use-case?

No dont have any reference.
Give me a sample to fetch from another doctype with reference

here doc.customer is reference.

{{ frappe.db.get_value(‘Customer’, doc.customer, ‘customer_type’) }}

I have given this in address doctype
Im getting error as
Traceback (innermost last):
File “/home/vaijeyanthi/frappe-bench/apps/frappe/frappe/”, line 51, in application
response = frappe.handler.handle()
File “/home/vaijeyanthi/frappe-bench/apps/frappe/frappe/”, line 69, in handle
File “/home/vaijeyanthi/frappe-bench/apps/frappe/frappe/”, line 92, in execute_cmd
ret =, **frappe.form_dict)
File “/home/vaijeyanthi/frappe-bench/apps/frappe/frappe/”, line 751, in call
return fn(*args, **newargs)
File “/home/vaijeyanthi/frappe-bench/apps/frappe/frappe/templates/pages/”, line 107, in get_html
html = template.render(args, filters={“len”: len})
File “/home/vaijeyanthi/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/”, line 969, in render
return self.environment.handle_exception(exc_info, True)
File “/home/vaijeyanthi/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/”, line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File “”, line 1, in template
TemplateSyntaxError: unexpected char u’&’ at 103

1 Like

please remove curly brackets,

frappe.db.get_value('Customer', doc.customer, 'customer_type')
1 Like

Can you share your print format?

if i remove curley brackets. it just printing

  frappe.db.get_value('Customer', doc.customer, 'customer_type')

the same

can you share your print format?

Ohh, you are using print format builder.
Please check my images


  1. in print format builder UI, Drag Custom HTML into location you want to print.
  2. Click on Edit Html
  3. write this code {{ frappe.db.get_value(‘Customer’, doc.customer, ‘customer_type’) }}
  4. refresh your print format. This will show customer details as Individual
1 Like

Ok … Thankyou… Its working

1 Like

@kolate_sambhaji: Hi Sambhaji,

I have address as a linked field in a doctype. All entries made while filling this DocType are storedas entries under “Address” DocType. When I want to print our the entire address in the print, how do I reference the particular address that is linked to this document? I hope this makes sense.

@Rohan_J You need to fetch address using Address template, then you can print it.

e.g.1 purchase common.js
//on selecting address in shipping_address full address is copied into shipping_address_display

	shipping_address: function(){
		var me = this;
		erpnext.utils.get_address_display(this.frm, "shipping_address",
			"shipping_address_display", is_your_company_address=true)


cur_frm.cscript.buyer = function() {
  erpnext.utils.get_address_display(this.frm, "buyer", "buyer_address");

//buyer is address field, and on select of buyer, I am fetching full address in buyer_address


Hi @kolate_sambhaji,

“get_address_display” is not working in v8, can you suggest changed method for v8?


Edit: found the solution
Replace: erpnext.utils.get_address_display
with : frappe.geo.doctype.address.address.get_address_display

1 Like

Hi @kolate_sambhaji
I am trying to create custom reports
any reference where i can start learning
what all language should i know

Welcome krishnanhemanth

There’s this if you have not seen it

Thanks for the reply clarkej
iam building custom reports for printing
for example sales invoice wrt my company standards
i go to customise
then pick or delete elements and click update
but nothing gets updated in the print
dont know whats wrong

Hi clarkej
Begining to get a feel of this
iam attaching a sample invoice
i want to get the bottom elements into the main section

how do i do it
plz help

Is that possibly an Item line item element from an Items table?

I seek working examples to learn how the Items table works.

I found these for ideas

Have you any favourite pointers to share?