Custom print format error

Hi,

Im trying create new print format via setup > Print > print format
in my firs tline
{% list_gl=frappe.get_all(“tabGL Entry”, filters={“voucher_no”: self.name}) %}
but im getting error that list_gl in undefined
but thats new variable that i just created , if im wrong how i can create new variable ?

Thanks

Why are you not using “General Ledger” report? It also have a default
print format. If you want, you can create a new customized print format
as well. But writing complicated logic in jinja is a bad idea, the
language is not optimized for that.

      Hi,

Here is my case, we need to print the GL because for every changes in
GL we need to print it to archive it and later is need to be given to
the tax collector as attached document, so we will print every changes
in GL and then makes the accountant sign it so they will know all the
changes in GL
actually i found this proses is not good and quite
complicated but, whatever i said they said they must do this for their
data and their tax report
thats why i want to add this as print format

any idea how i can do this?
or i should add a button that will
generate this ?.. but how a button can refer to a print format because
i think (at least so far i understand) that 1 doctype can only have 1
html as their print format, and for this case sales order and PO and JV ,
STE ,etc all predefined module have it

Thanks

Still I dont understand why are you not using Accounts -> Main Reports -> General Ledger report? In this report you can filter GL for any voucher and then print the report using print button. You can also use a dedicated button View Ledger inside the voucher toolbar, it will show all GL for that voucher.

And you can add multiple print format to a document.

i have already suggested this step before actually, but they said to me that

For this document we need to create a certain print format (its different for some document) , and i dont think for this i want to change the print format for GL report

and besides actually printing from a separated document not straight at the SO or PO or etc is making chance to miss some document and it will take longer step

Hi @bobzz_zone,

Were you able to figure this out? I need to do this as well.

Thanks

we cant do request data from database i think :slight_smile:

Ok. Thanks @bobzz_zone :slight_smile:

@bobzz_zone,

In case you still need this:

{%- for row in frappe.get_list(doctype="GL Entry",
        fields = ["account", "debit", "credit", "party"],
        filters = {"voucher_no":doc.name},
        order_by = "-debit") -%}
      <tr>
        <td>{{ row.account }} &emsp;{{ row.party or "" }}</td>
        <td class="text-right">{{ frappe.format_value(row.debit, {"fieldtype":"Currency"}, currency=doc.currency) }}</td>
        <td class="text-right">{{ frappe.format_value(row.credit, {"fieldtype":"Currency"}, currency=doc.currency) }}</td>
      </tr>
{%- endfor -%}
1 Like