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.
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