From 2b8344e75c9bf6b11e2d10e0e06b12bbe8ccffdf Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 5 Aug 2014 11:30:37 +0530 Subject: [PATCH 1/3] [print] [fix] when item grid is empty --- erpnext/templates/print_formats/includes/item_grid.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/templates/print_formats/includes/item_grid.html b/erpnext/templates/print_formats/includes/item_grid.html index d6ab347c92..a51339c516 100644 --- a/erpnext/templates/print_formats/includes/item_grid.html +++ b/erpnext/templates/print_formats/includes/item_grid.html @@ -1,8 +1,8 @@ {%- from "templates/print_formats/standard_macros.html" import print_value -%} {%- set std_fields = ("item_code", "item_name", "description", "qty", "rate", "amount", "stock_uom", "uom") -%} {%- set visible_columns = get_visible_columns(doc.get(df.fieldname), table_meta) -%} -{%- set hide_rate = data[0].meta.is_print_hide("rate") -%} -{%- set hide_amount = data[0].meta.is_print_hide("amount") -%} +{%- set hide_rate = data[0].meta.is_print_hide("rate") if len(data) else False-%} +{%- set hide_amount = data[0].meta.is_print_hide("amount") if len(data) else False-%} From 8d16e9fd6d262cc2ffdd367e0c84d6a3ae0681eb Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 5 Aug 2014 11:39:51 +0530 Subject: [PATCH 2/3] [print] convert newlines to
based on fieldtype for Text/Small Text --- erpnext/templates/print_formats/includes/item_grid.html | 4 ++-- erpnext/templates/print_formats/includes/taxes.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/templates/print_formats/includes/item_grid.html b/erpnext/templates/print_formats/includes/item_grid.html index a51339c516..553d9f84ec 100644 --- a/erpnext/templates/print_formats/includes/item_grid.html +++ b/erpnext/templates/print_formats/includes/item_grid.html @@ -22,12 +22,12 @@ {%- endif %} {% if (not row.meta.is_print_hide("item_name") and (row.meta.is_print_hide("item_code") or row.item_code != row.item_name)) -%} -
{{ row.get_formatted("item_name",as_html=True) }}
+
{{ row.get_formatted("item_name") }}
{%- endif %} {% if (not row.meta.is_print_hide("description") and row.description and ((row.meta.is_print_hide("item_code") and row.meta.is_print_hide("item_name")) or not (row.item_code == row.item_name == row.description))) -%} -

{{ row.get_formatted("description", as_html=True) }}

+

{{ row.get_formatted("description") }}

{%- endif %} {%- for field in visible_columns -%} {%- if (field.fieldname not in std_fields) and diff --git a/erpnext/templates/print_formats/includes/taxes.html b/erpnext/templates/print_formats/includes/taxes.html index 50f9d86a38..bd1e709787 100644 --- a/erpnext/templates/print_formats/includes/taxes.html +++ b/erpnext/templates/print_formats/includes/taxes.html @@ -5,7 +5,7 @@ {%- if not charge.included_in_print_rate -%}
-
+
{{ frappe.format_value(charge.tax_amount / doc.conversion_rate, table_meta.get_field("tax_amount"), doc, currency=doc.currency) }} From f16fefafe359dd679e4110060439f7b32a756984 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 5 Aug 2014 13:57:29 +0530 Subject: [PATCH 3/3] [print] [fix] empty item grid issue --- erpnext/templates/print_formats/includes/item_grid.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/templates/print_formats/includes/item_grid.html b/erpnext/templates/print_formats/includes/item_grid.html index 553d9f84ec..1d09f73fec 100644 --- a/erpnext/templates/print_formats/includes/item_grid.html +++ b/erpnext/templates/print_formats/includes/item_grid.html @@ -1,8 +1,8 @@ {%- from "templates/print_formats/standard_macros.html" import print_value -%} {%- set std_fields = ("item_code", "item_name", "description", "qty", "rate", "amount", "stock_uom", "uom") -%} {%- set visible_columns = get_visible_columns(doc.get(df.fieldname), table_meta) -%} -{%- set hide_rate = data[0].meta.is_print_hide("rate") if len(data) else False-%} -{%- set hide_amount = data[0].meta.is_print_hide("amount") if len(data) else False-%} +{%- set hide_rate = data[0].meta.is_print_hide("rate") if data|length else False-%} +{%- set hide_amount = data[0].meta.is_print_hide("amount") if data|length else False-%}