[New Feature Proposal] doc other than doctype wise default print format based on condition

Currently it is possible to define multiple print formats per different business case for one doctype, but only one default print format can be set per doctype, ever time after user clicked print button from form view and system jumped to print preview screen, he/she need to manually select the print format from available print format dropdown list, which is tedious and not user friendly.

SAP uses multi mapping tables(selected key fields from document, mapped to the target print format) to auto assign the print out format per document content.

Proposed solution
Design

  1. add 2 fields to print format doctype: condition(python code) and priority

  2. python function to fetch doc wise default print format by condition and priority

  3. overwrite js function in print.js to set default print format by calling the above function

Use

  1. Maintain the condition as default for the print format

related thread

Any ideas whether it is feasible to make a pull request ?

18 Likes

Thanks for sharing sir.
Quick question, for which Frappe version is this ?

Regards,
Subhajit

I implemented this proposed feature in my own app for frappe/erpnext version 13. here I would like to know whether there is enough requirements from the community members.
based on the feedback from community I will create pull request accordingly.

thanks.

3 Likes

ERPNext already has a similar functionality. For example, if you generate a POS Invoice from Sales Invoice doctype, the print format defaults to POS one. I believe it works by setting the value of Print Format field in the Print Setting section in Sales Invoice using a client script.

Although, this might be as better solution.

Seems like a useful feature :+1:

1 Like

+1 from me

Nice idea

+1 from me

@ankush

can you help to pickup my rejected PR https://github.com/frappe/frappe/pull/15350, polish and merge it to the core?

thanks.

For me yes, I have a need to have different print format for Purchase order per supplier.