One Time Print Option

I want the user to print payment entries only once or twice. Is there any option by which we can set a limit on any doc for printing?

This requires creating a doctype called PrintCount, and storing all the data in it. It can be done but a very long development has to be done.

Is there no other solution?

There is no other way. The main thing is logic is important.

Whenever we click on the print button or PDF in the ERPNext system, system create a record in the Access Log with details such as export_from: 'Payment Entry', reference_document: frm.doc.name, file_type: 'PDF', and method: 'Print'.

You can create logic to connect this and restrict the printing if needed.

I have implemented a similar feature to display “Original” on the first print and “Duplicate” on subsequent prints by using Jinja.

<div class="print-heading">				
    <h2>
        {%  if frappe.get_list("Access Log", filters={
                        "reference_document": doc.name, 
                        "file_type": "PDF",
                        "method": "Print"
                    })|length > 1 
        %}
            <div>Duplicate</div>
        {% else %}
            <div>Original</div>
        {% endif %}
        <small class="sub-heading">{{ doc.name }}</small>
    </h2>
</div>
5 Likes

Thanks

1 Like