From 50eb6786bf73c78209b1b28c55b802c650b7a2ea Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Thu, 9 Oct 2025 17:31:18 +0530 Subject: [PATCH] feat: condition based item code column --- .../print_format_sales_invoice.html | 22 +++++++++---------- .../sales_invoice_print_format.html | 14 ++++++------ 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/erpnext/accounts/print_format/print_format_sales_invoice/print_format_sales_invoice.html b/erpnext/accounts/print_format/print_format_sales_invoice/print_format_sales_invoice.html index 7cc20b6e912..ae0a0dbb77a 100644 --- a/erpnext/accounts/print_format/print_format_sales_invoice/print_format_sales_invoice.html +++ b/erpnext/accounts/print_format/print_format_sales_invoice/print_format_sales_invoice.html @@ -208,18 +208,15 @@ print_heading_template=None) -%} + {% set item_naming_by = frappe.db.get_single_value("Stock Settings", "item_naming_by") %} - - - - - - - - + + {% if item_naming_by != "Item Code" %} + + {% endif %} @@ -239,10 +236,8 @@ print_heading_template=None) -%} alt="{{ item.item_name }}" style=" border-radius: 6px; - max-height: 24px; - min-height: 24px; - max-width: 24px; - min-width: 24px; + height: 24px; + width: 24px !important; margin-right: 8px; vertical-align: middle; " @@ -258,6 +253,9 @@ print_heading_template=None) -%}
{{ _("No") }}{{ _("No") }} {{ _("Item") }}{{ _("Item Code") }}{{ _("Quantity") }} {{ _("Rate") }} {{ _("Amount") }}
+ {% if item_naming_by != "Item Code" %} + {{ item.item_code }} + {% endif %} {{ item.get_formatted("qty", 0) }} {{ item.uom }} {{ item.get_formatted("net_rate", doc) }} diff --git a/erpnext/accounts/print_format/sales_invoice_print_format/sales_invoice_print_format.html b/erpnext/accounts/print_format/sales_invoice_print_format/sales_invoice_print_format.html index f5143157a95..e11d8c97d69 100644 --- a/erpnext/accounts/print_format/sales_invoice_print_format/sales_invoice_print_format.html +++ b/erpnext/accounts/print_format/sales_invoice_print_format/sales_invoice_print_format.html @@ -236,18 +236,15 @@ print_heading_template=None) -%} + {% set item_naming_by = frappe.db.get_single_value("Stock Settings", "item_naming_by") %} - - - - - - - + {% if item_naming_by != "Item Code" %} + + {% endif %} @@ -258,6 +255,9 @@ print_heading_template=None) -%} + {% if item_naming_by != "Item Code" %} + + {% endif %}
{{ _("No") }} {{ _("Item") }}{{ _("Item Code") }}{{ _("Quantity") }} {{ _("Rate") }} {{ _("Amount") }}
{{ loop.index }} {{ item.item_name }}{{ item.item_code }}{{ item.get_formatted("qty", 0) }} {{ item.uom }} {{ item.get_formatted("net_rate", doc) }}