Invoice copy printing

Need to print 4 copies of sales invoice in a single click,with the first copy mentioned as original second as duplicate,third as triplicate and fourth as quadraplicate.
Some one help us in this regard.

The unique way to achieve that is creating a custom HTML Print Format Template.

You can write a for to repeat the invoice content, inside a page break.

I did that in the past, in a sample you can see here

Look for line 13 of the HTML template

3 Likes

Thanks.
I am an end user.
We will inform our support consultants.

We’re working to comply with our local authority in Zambia. One of the things we are trying to figure out is changing the invoice label from Original to Copy

We have implemented the same india’s localisation using a hidden field with {{ doc.invoice_copy}} in the print format. But we can not find a way to update this when the document gets printed.

@nabinhait please please guide us if you can :slight_smile:

image.png

Can you share your print format? Maybe the community can have a go at it.

Thanks for your response Muzzy

the only difference from a normal print format is that we added a field called invoice_copy and call it in the print format. We just need to change the value after a print-out or download is done.

Frappe has all kinds of doc events but print buttons events have no documentation

Has no one here found a solution to showing duplicate invoice labels?

@adam26d referring to this

You can do:

{% if not frappe.db.count("Access Log", {"export_from": doc.doctype, "reference_document": doc.name, "file_type": "PDF", "method": "Print"}) %}
<H3>Original</H3>
{% else %}
<H3>Copy</H3>
{% endif %}
6 Likes

Thanks @max_morais_dmm, I’ll try this. Wasnt aware logs captured print events

Thanks @max_morais_dmm

Jinja has a few oddities, I had to modify my print header to this.

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

I can comfirm that this WORKS!

9 Likes

There is some amount of learning daily on this forum. Never thought log events could be used to achieve this result.

1 Like

Same here lol