From 0feaafff21f4618f957dc655059fa40df1bb4733 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Thu, 25 Feb 2021 15:37:07 +0530 Subject: [PATCH 1/2] fix: respect % width while building print formats --- frappe/templates/print_formats/standard_macros.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frappe/templates/print_formats/standard_macros.html b/frappe/templates/print_formats/standard_macros.html index 0186346840..a637a7befb 100644 --- a/frappe/templates/print_formats/standard_macros.html +++ b/frappe/templates/print_formats/standard_macros.html @@ -165,7 +165,12 @@ data-fieldname="{{ df.fieldname }}" data-fieldtype="{{ df.fieldtype }}" {%- endmacro %} {% macro get_width(df) -%} - {%- if df.print_width -%}{{ (df.print_width|str).replace("px", "") }}px + {%- if df.print_width -%} + {%- if df.print_width.endswith("%") -%} + {{ df.print_width }} + {%- else -%} + {{ (df.print_width|str).replace("px", "") }}px + {%- endif -%} {%- elif df.fieldtype in ("Int", "Check", "Float", "Currency") -%}{{ 80 }}px {%- else -%}{{ 150 }}px{% endif -%} {%- endmacro %} From 3def386b053dc321db6f049b2b7dcf5bfeb830a1 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Thu, 25 Feb 2021 15:54:50 +0530 Subject: [PATCH 2/2] fix: remove unnecessary type-casting --- frappe/templates/print_formats/standard_macros.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/templates/print_formats/standard_macros.html b/frappe/templates/print_formats/standard_macros.html index a637a7befb..f8dc6c370c 100644 --- a/frappe/templates/print_formats/standard_macros.html +++ b/frappe/templates/print_formats/standard_macros.html @@ -169,7 +169,7 @@ data-fieldname="{{ df.fieldname }}" data-fieldtype="{{ df.fieldtype }}" {%- if df.print_width.endswith("%") -%} {{ df.print_width }} {%- else -%} - {{ (df.print_width|str).replace("px", "") }}px + {{ df.print_width.replace("px", "") }}px {%- endif -%} {%- elif df.fieldtype in ("Int", "Check", "Float", "Currency") -%}{{ 80 }}px {%- else -%}{{ 150 }}px{% endif -%}