Get print formats of certain doctype

I normally use the following code to get the print formats of the current doctype.

print_formats = frappe.meta.get_print_formats(doctype);

Was wondering if there is a way to get the print formats of a doctype that is different from the cur frm’s doctype?
My use case: printing a document that is related to a certain doc i.e. sales invoices of the same project. I’d like to have options of print formats when printing.

@Kar_M ever get this working?

I believe I ended up doing it server side and placed buttons on the project doc to print all quotes,SOs or Invoices. We don’t use it much since the ability to print selected docs from the doclist view was added.

def get_print_formats(self,doctype):
		print_formats = frappe.db.sql("""select name FROM `tabPrint Format`
			WHERE doc_type=%s AND docstatus<2 and disabled=0""", (doctype,), as_dict=1)
		return print_formats
1 Like

This topic was automatically closed after 24 hours. New replies are no longer allowed.