Packing List Template

Hello. My instance of IP at the moment is for a wholesale client. He gives the invoice to the purchaser (corporate) and a packing list to the retailer (store manager). It wasn’t hard to create and here is how I did it if others are interested in it.

  1. Updated Invoice Controller
public function generate_pkgpdf($invoice_id, $stream = true, $invoice_template = 'packingList.php')
    {
        $this->load->helper('pdf');

        generate_invoice_pdf($invoice_id, $stream, $invoice_template, null);
    }
  1. duplicated the default invoiceplane template, renamed it to ‘packingList.php’, and stripped the price columns out.

  2. added an additional headerbar option item in the ‘view’ invoice view
    –not so clean but does the trick.

<li>
                    <a href="../generate_pkgpdf/<?=$invoice_id?>" target="blank">
                        <i class="fa fa-print fa-margin"></i>
                        Packing List
                    </a>
                </li>

1 Like

Good contribution. I suppose the same can apply for a delivery note.

This might be handy to keep around if/when inventory management is introduced.

@jdmdigital Interesting your project can you share the template code?

  1. invoices.php
//Packing List
public function generate_pkgpdf($invoice_id, $stream = true, $invoice_template = 'PackingList PDF Template')
{
    $this->load->helper('pdf');

    generate_invoice_pdf($invoice_id, $stream, $invoice_template, null);
}
  1. view.php
          <!--Packing List-->
            <li>
                <a href="../generate_pkgpdf/<?=$invoice_id?>" target="blank">
                    <i class="fa fa-print fa-margin"></i>
                    <?php _trans('Packing_List'); ?>
                </a>
            </li>
          <!--Packing List-->
  1. IP_lang.php

// Packing List
‘Packing_List’ => ‘Packing List’,

After the Update to InvoicePlane 1.7.x, InvoicePlane wouldn’t use the right template anymore, but just take the standard InvoicePlane one.

It turns out, while InvoicePlane was previously fine with (or wanted?) the full template including the file extension, from version 1.7 on, you need to leave out the file extension. So instead of $invoice_template = ‘packingList.php’ you now need to use $invoice_template = ‘packingList’

Just leaving this here for future reference

Just for your information: InvoicePlane hasn’t done anything with “packing list”.

It’s good that you give this information, but it’s purely for users using this mod and changing / maintaining this mod every time a new version comes out.

I’ll keep saying this:
use at your own risk!
If $invoice_id comes from the url and you type something weird in the url you’ll have a security vulnerability.
Be careful which mod you’re using from anywhere

Something simple: in InvoicePlane’s standards all translation keys are in lowercase.
I mean: it can be changed easily, but just saying…
And now you can easily recognize the mod from a random post in a forum…