Hi,
i just tried create new print format for purchase order and getting this error :
Traceback (innermost last):
File “/home/sigma/frappe-bench/apps/frappe/frappe/app.py”, line 51, in application
response = frappe.handler.handle()
File “/home/sigma/frappe-bench/apps/frappe/frappe/handler.py”, line 62, in handle
execute_cmd(cmd)
File “/home/sigma/frappe-bench/apps/frappe/frappe/handler.py”, line 85, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/sigma/frappe-bench/apps/frappe/frappe/init.py”, line 708, in call
return fn(*args, **newargs)
File “/home/sigma/frappe-bench/apps/frappe/frappe/templates/pages/print.py”, line 107, in get_html
html = template.render(args, filters={“len”: len})
File “/home/sigma/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 969, in render
return self.environment.handle_exception(exc_info, True)
File “/home/sigma/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "
and my code is :
Custom code :
{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead) -%}
{% if letter_head and not no_letterhead %}
{% endif %}
{%- if doc.meta.is_submittable and doc.docstatus==0-%}
{{ _(“DRAFT”) }}
{%- endif -%}
{%- if doc.meta.is_submittable and doc.docstatus==2-%}
{{ _(“CANCELLED”) }}
{%- endif -%}
{% if max_pages > 1 %}
{{ _(“Page #{0} of {1}”).format(page_num, max_pages) }}
{% endif %}
{%- endmacro -%} .table-hover>tbody>tr:hover>td, .table-hover>tbody>tr:hover>th { background-color: #B7CCF2; color:#000000; font-size:16px; } .print-format table, .print-format tr, .print-format td, .print-format div, .print-format p { font-family: sans-serif; line-height: 90%; vertical-align: middle; } @media screen { .print-format { width: 210mm; padding: 10mm; min-height: 297mm; footer {page-break-after: always;} } } {{ add_header(0,1,doc,letter_head, no_letterhead) }}
{{ doc.select_print_heading or (doc.print_heading if doc.print_heading != None else _(doc.doctype)) }} |
{{ _("#") }}{{ doc.name }} |
{{ _("To") }}: {{ doc.customer_name }} {{ _("Address") }}: {{ doc.address_display }} |
{{ _("Ship To") }}: {{ doc.shipping_address_title }} {{ _("Address") }}: {{ doc.shipping_address }} |
{{ _("Date") }}: {{ doc.get_formatted("transaction_date") }} {{ _("PO #") }}: {{ doc.po_no }} {{ _("PO Date") }}: {{ doc.get_formatted("po_date") }} |
Sr | Description | Qty | Rate | Amount |
---|---|---|---|---|
{{ row.idx }} | {{ row.description }} | {{ row.qty }} {{ row.uom or row.stock_uom }} | {{ row.get_formatted("rate", doc) }} | {{ row.get_formatted("amount", doc) }} |
{% if doc.terms %} {{ _("Auxiliary Information") }}: {{ doc.terms or "" }} {%- endif -%} {% if doc.in_words_export %}
{{ _("Total Amount (In Words)") }}:
|
{%- for row in doc.other_charges -%}
{%- if not row.included_in_print_rate -%}
{%- if row.tax_amount -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if doc.discount_amount -%}
{%- endif -%}
Taxes Included: {%- for row in doc.other_charges -%} {%- if row.included_in_print_rate -%}
please help on this… |