'Generate a PDF of a Waybill'

@staticmethod
def inv_send_form(r, **attr):

    db = current.db
    table = db.inv_send
    tracktable = db.inv_track_item
    table.date.readable = True
    record = db((table.id == r.id)).select(table.send_ref, limitby=(0, 1)).first()
    send_ref = record.send_ref
    tracktable.send_inv_item_id.readable = False
    tracktable.recv_inv_item_id.readable = False
    T = current.T
    list_fields = [(T('Item    Code'), 'item_id$code'), 'item_id', (T('Weight    (kg)'), 'item_id$weight'), (T('Volume    (m3)'), 'item_id$volume'), 'bin', 'item_source_no', 'item_pack_id', 'quantity']
    settings = current.deployment_settings
    if r.record.req_ref:
        list_fields.append('req_item_id$comments')
    if settings.get_inv_track_pack_values():
        (list_fields + ['currency', 'pack_value'])
    from s3.s3export import S3Exporter
    exporter = S3Exporter().pdf
    return exporter(r.resource, request=r, method='list', pdf_componentname='track_item', pdf_title=settings.get_inv_send_form_name(), pdf_filename=send_ref, list_fields=list_fields, pdf_hide_comments=True, pdf_header_padding=12, pdf_footer=inv_send_pdf_footer, pdf_paper_alignment='Landscape', pdf_table_autogrow='B', **attr)
