From 06ce46037ed8f91f2670254356408844d7486da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20N=C3=A4s?= Date: Thu, 20 Nov 2025 10:12:26 +0100 Subject: [PATCH 1/7] feat: add support for printing serial and batch number barcodes in doctypes Purchase receipt, Stock Entry and Delivery Note --- erpnext/controllers/accounts_controller.py | 3 ++ erpnext/controllers/print_settings.py | 15 +++++++ erpnext/setup/install.py | 14 +++++++ .../includes/batch_no_barcodes.html | 34 +++++++++++++++ .../serial_and_batch_no_barcodes.html | 41 +++++++++++++++++++ .../includes/serial_no_barcodes.html | 34 +++++++++++++++ 6 files changed, 141 insertions(+) create mode 100644 erpnext/templates/print_formats/includes/batch_no_barcodes.html create mode 100644 erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html create mode 100644 erpnext/templates/print_formats/includes/serial_no_barcodes.html diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 3902b2f72028..1329f88b83f9 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -111,6 +111,9 @@ def get_print_settings(self): if taxes_field and taxes_field.fieldtype == "Table": print_setting_fields += ["print_taxes_with_zero_amount"] + if self.docstatus == 1 and self.doctype in ["Purchase Receipt", "Stock Entry", "Delivery Note"]: + print_setting_fields += ["print_batch_no_barcodes", "print_serial_no_barcodes"] + return print_setting_fields @property diff --git a/erpnext/controllers/print_settings.py b/erpnext/controllers/print_settings.py index f05ef67c3087..331e096105e2 100644 --- a/erpnext/controllers/print_settings.py +++ b/erpnext/controllers/print_settings.py @@ -28,6 +28,21 @@ def set_print_templates_for_item_table(doc, settings): ] = "templates/print_formats/includes/item_table_description.html" doc.flags.format_columns = format_columns + elif (settings.print_batch_no_barcodes and settings.print_serial_no_barcodes): + doc.print_templates = { + "items": "templates/print_formats/includes/serial_and_batch_no_barcodes.html" + } + + elif settings.print_batch_no_barcodes: + doc.print_templates = { + "items": "templates/print_formats/includes/batch_no_barcodes.html" + } + + elif settings.print_serial_no_barcodes: + doc.print_templates = { + "items": "templates/print_formats/includes/serial_no_barcodes.html" + } + def set_print_templates_for_taxes(doc, settings): doc.flags.show_inclusive_tax_in_print = doc.is_inclusive_tax() diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py index 7dc7932470e1..ce3776ead0ab 100644 --- a/erpnext/setup/install.py +++ b/erpnext/setup/install.py @@ -114,6 +114,20 @@ def create_print_setting_custom_fields(): "default": "0", "insert_after": "allow_print_for_cancelled", }, + { + "label": _("Print Batch no barcodes"), + "fieldname": "print_batch_no_barcodes", + "fieldtype": "Check", + "default": "0", + "insert_after": "print_taxes_with_zero_amount", + }, + { + "label": _("Print Serial no barcodes"), + "fieldname": "print_serial_no_barcodes", + "fieldtype": "Check", + "default": "0", + "insert_after": "print_batch_no_barcodes", + } ] } ) diff --git a/erpnext/templates/print_formats/includes/batch_no_barcodes.html b/erpnext/templates/print_formats/includes/batch_no_barcodes.html new file mode 100644 index 000000000000..41b56a4d1602 --- /dev/null +++ b/erpnext/templates/print_formats/includes/batch_no_barcodes.html @@ -0,0 +1,34 @@ + + + + + + + + {%- for row in doc.items -%} + + + + + + {%- endfor -%} + +
NoItem NameBatch No Barcodes
{{ row.idx }}{{ row.item_name }} + {% set bundle_data = frappe.get_all( + 'Serial and Batch Entry', + fields=['batch_no'], + filters={'parent': row.serial_and_batch_bundle} + ) %} + {% for d in bundle_data %} + {% if d.batch_no %} + + {% endif %} + {% endfor %} +
+ + + diff --git a/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html b/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html new file mode 100644 index 000000000000..d978c5d541a7 --- /dev/null +++ b/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html @@ -0,0 +1,41 @@ + + + + + + + + + {%- for row in doc.items -%} + + + + {% set bundle_data = frappe.get_all( + 'Serial and Batch Entry', + fields=['batch_no','serial_no'], + filters={'parent': row.serial_and_batch_bundle} + ) %} + {% for d in bundle_data %} + + + {% endfor %} + + {%- endfor -%} + +
NoItem NameBatch No BarcodesSerial No Barcodes
{{ row.idx }}{{ row.item_name }} + {% if d.batch_no %} + + {% endif %} + + {% if d.serial_no %} + + {% endif %} +
+ + + diff --git a/erpnext/templates/print_formats/includes/serial_no_barcodes.html b/erpnext/templates/print_formats/includes/serial_no_barcodes.html new file mode 100644 index 000000000000..352820dbcd44 --- /dev/null +++ b/erpnext/templates/print_formats/includes/serial_no_barcodes.html @@ -0,0 +1,34 @@ + + + + + + + + {%- for row in doc.items -%} + + + + + + {%- endfor -%} + +
NoItem NameSerial No Barcodes
{{ row.idx }}{{ row.item_name }} + {% set bundle_data = frappe.get_all( + 'Serial and Batch Entry', + fields=['serial_no'], + filters={'parent': row.serial_and_batch_bundle} + ) %} + {% for d in bundle_data %} + {% if d.serial_no %} + + {% endif %} + {% endfor %} +
+ + + From 43dccd47a7f34b943bec35c81218bcadb2153747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20N=C3=A4s?= Date: Tue, 25 Nov 2025 18:14:26 +0100 Subject: [PATCH 2/7] feat: enable barcode customization --- .../purchase_receipt/purchase_receipt.json | 68 ++++++++++++++++++- .../purchase_receipt/purchase_receipt.py | 8 +++ .../includes/batch_no_barcodes.html | 38 ++++++++++- .../serial_and_batch_no_barcodes.html | 66 +++++++++++++++++- .../includes/serial_no_barcodes.html | 37 +++++++++- 5 files changed, 211 insertions(+), 6 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json index 1c8fccf4849a..060a3421f743 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json @@ -137,6 +137,14 @@ "printing_settings", "letter_head", "group_same_items", + "print_serial_or_batch_number_for_barcode", + "print_item_name_for_barcode", + "print_item_cost_for_barcode", + "print_font_for_barcodes", + "print_font_size_for_barcodes", + "print_height_for_barcode", + "print_width_for_barcode", + "print_barcode_color", "column_break_97", "select_print_heading", "language", @@ -1302,6 +1310,63 @@ "label": "Item Wise Tax Details", "no_copy": 1, "options": "Item Wise Tax Detail" + }, + { + "allow_on_submit": 1, + "default": "0", + "fieldname": "print_item_name_for_barcode", + "fieldtype": "Check", + "label": "Print item name for barcode" + }, + { + "allow_on_submit": 1, + "default": "0", + "fieldname": "print_item_cost_for_barcode", + "fieldtype": "Check", + "label": "Print item cost for barcode" + }, + { + "allow_on_submit": 1, + "default": "2", + "fieldname": "print_width_for_barcode", + "fieldtype": "Int", + "label": "Print width for barcode" + }, + { + "allow_on_submit": 1, + "default": "40", + "fieldname": "print_height_for_barcode", + "fieldtype": "Int", + "label": "Print height for barcode" + }, + { + "allow_on_submit": 1, + "default": "Helvetica, Arial, sans-serif", + "fieldname": "print_font_for_barcodes", + "fieldtype": "Select", + "label": "Print font for barcodes", + "options": "Helvetica, Arial, sans-serif\nArial, sans-serif\nVerdana, sans-serif\nTahoma, sans-serif\n\"Times New Roman\", Times, serif\n\"Roboto\", sans-serif\n\"Lato\", sans-serif\nConsolas, Helvetica, Arial, sans-serif" + }, + { + "allow_on_submit": 1, + "default": "1", + "fieldname": "print_serial_or_batch_number_for_barcode", + "fieldtype": "Check", + "label": "Print serial or batch number for barcode" + }, + { + "allow_on_submit": 1, + "default": "#000000", + "fieldname": "print_barcode_color", + "fieldtype": "Color", + "label": "Print color for barcode" + }, + { + "allow_on_submit": 1, + "default": "12", + "fieldname": "print_font_size_for_barcodes", + "fieldtype": "Int", + "label": "Print font size for barcodes" } ], "grid_page_length": 50, @@ -1309,7 +1374,7 @@ "idx": 261, "is_submittable": 1, "links": [], - "modified": "2025-11-12 19:53:48.173096", + "modified": "2025-11-25 17:49:40.664691", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt", @@ -1380,4 +1445,3 @@ "title_field": "title", "track_changes": 1 } - diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 9708f3dfa1a0..5b468b55e79a 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -103,6 +103,14 @@ class PurchaseReceipt(BuyingController): posting_time: DF.Time price_list_currency: DF.Link | None pricing_rules: DF.Table[PricingRuleDetail] + print_barcode_color: DF.Color | None + print_font_for_barcodes: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] + print_font_size_for_barcodes: DF.Int + print_height_for_barcode: DF.Int + print_item_cost_for_barcode: DF.Check + print_item_name_for_barcode: DF.Check + print_serial_or_batch_number_for_barcode: DF.Check + print_width_for_barcode: DF.Int project: DF.Link | None range: DF.Data | None rejected_warehouse: DF.Link | None diff --git a/erpnext/templates/print_formats/includes/batch_no_barcodes.html b/erpnext/templates/print_formats/includes/batch_no_barcodes.html index 41b56a4d1602..2eb66ec750b2 100644 --- a/erpnext/templates/print_formats/includes/batch_no_barcodes.html +++ b/erpnext/templates/print_formats/includes/batch_no_barcodes.html @@ -1,3 +1,11 @@ + + @@ -17,7 +25,35 @@ ) %} {% for d in bundle_data %} {% if d.batch_no %} - +
+ + {% if doc.print_item_name_for_barcode %} +
+ {{ row.item_name }} +
+ {% endif %} + + {% if doc.print_item_cost_for_barcode %} +
+ {{ row.rate }} {{ doc.currency }} +
+ {% endif %} + + + + {% if doc.print_serial_or_batch_number_for_barcode %} +
+ {{ d.batch_no }} +
+ {% endif %} +
{% endif %} {% endfor %} diff --git a/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html b/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html index d978c5d541a7..21d37bf5a3ee 100644 --- a/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html +++ b/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html @@ -1,3 +1,11 @@ + +
@@ -18,12 +26,66 @@ {% for d in bundle_data %} {% endfor %} diff --git a/erpnext/templates/print_formats/includes/serial_no_barcodes.html b/erpnext/templates/print_formats/includes/serial_no_barcodes.html index 352820dbcd44..54c892eab7c1 100644 --- a/erpnext/templates/print_formats/includes/serial_no_barcodes.html +++ b/erpnext/templates/print_formats/includes/serial_no_barcodes.html @@ -1,3 +1,11 @@ + +
{% if d.batch_no %} - +
+ {% if doc.print_item_name_for_barcode %} +
+ {{ row.item_name }} +
+ {% endif %} + + {% if doc.print_item_cost_for_barcode %} +
+ {{ row.rate }} {{ doc.currency }} +
+ {% endif %} + + + + {% if doc.print_serial_or_batch_number_for_barcode %} +
+ {{ d.batch_no }} +
+ {% endif %} +
{% endif %}
{% if d.serial_no %} - +
+ {% if doc.print_item_name_for_barcode %} +
+ {{ row.item_name }} +
+ {% endif %} + + {% if doc.print_item_cost_for_barcode %} +
+ {{ row.rate }} {{ doc.currency }} +
+ {% endif %} + + + + {% if doc.print_serial_or_batch_number_for_barcode %} +
+ {{ d.serial_no }} +
+ {% endif %} +
{% endif %}
@@ -17,7 +25,34 @@ ) %} {% for d in bundle_data %} {% if d.serial_no %} - +
+ {% if doc.print_item_name_for_barcode %} +
+ {{ row.item_name }} +
+ {% endif %} + + {% if doc.print_item_cost_for_barcode %} +
+ {{ row.rate }} {{ doc.currency }} +
+ {% endif %} + + + + {% if doc.print_serial_or_batch_number_for_barcode %} +
+ {{ d.serial_no }} +
+ {% endif %} +
{% endif %} {% endfor %} From 0e22363357c6fc4a3a9ed5d66330a441b46728fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20N=C3=A4s?= Date: Tue, 25 Nov 2025 19:18:30 +0100 Subject: [PATCH 3/7] refactor: clean up batch and serial barcode loops for safety and readability --- .../includes/batch_no_barcodes.html | 2 +- .../serial_and_batch_no_barcodes.html | 62 ++++++++++--------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/erpnext/templates/print_formats/includes/batch_no_barcodes.html b/erpnext/templates/print_formats/includes/batch_no_barcodes.html index 2eb66ec750b2..2992f90864f1 100644 --- a/erpnext/templates/print_formats/includes/batch_no_barcodes.html +++ b/erpnext/templates/print_formats/includes/batch_no_barcodes.html @@ -29,7 +29,7 @@ {% if doc.print_item_name_for_barcode %}
- {{ row.item_name }} + {{ row.item_name }}
{% endif %} diff --git a/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html b/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html index 21d37bf5a3ee..368230ded0fc 100644 --- a/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html +++ b/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html @@ -23,45 +23,47 @@ fields=['batch_no','serial_no'], filters={'parent': row.serial_and_batch_bundle} ) %} - {% for d in bundle_data %} -
- + - {% endfor %} + {% endfor %} + {%- endfor -%} From f6e3635da920ff2b5f2ad180a763481cc8349da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20N=C3=A4s?= Date: Wed, 26 Nov 2025 11:14:42 +0100 Subject: [PATCH 4/7] feat: extend barcode customization to cover Delivery note and Stock entry doctypes --- .../doctype/delivery_note/delivery_note.json | 64 +++++++++++++++++- .../doctype/delivery_note/delivery_note.py | 8 +++ .../doctype/stock_entry/stock_entry.json | 67 ++++++++++++++++++- .../stock/doctype/stock_entry/stock_entry.py | 8 +++ 4 files changed, 145 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index f3b44402dc84..d5e532da344a 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -151,6 +151,14 @@ "letter_head", "print_without_amount", "group_same_items", + "print_serial_or_batch_number_for_barcode", + "print_item_name_for_barcode", + "print_item_cost_for_barcode", + "print_font_for_barcodes", + "print_font_size_for_barcodes", + "print_height_for_barcode", + "print_width_for_barcode", + "print_barcode_color", "column_break_88", "select_print_heading", "language", @@ -1427,13 +1435,67 @@ "label": "Item Wise Tax Details", "no_copy": 1, "options": "Item Wise Tax Detail" + }, + { + "allow_on_submit": 1, + "default": "1", + "fieldname": "print_serial_or_batch_number_for_barcode", + "fieldtype": "Check", + "label": "Print serial or batch number for barcode" + }, + { + "allow_on_submit": 1, + "default": "0", + "fieldname": "print_item_name_for_barcode", + "fieldtype": "Check", + "label": "Print item name for barcode" + }, + { + "allow_on_submit": 1, + "default": "0", + "fieldname": "print_item_cost_for_barcode", + "fieldtype": "Check", + "label": "Print item cost for barcode" + }, + { + "fieldname": "print_font_for_barcodes", + "fieldtype": "Select", + "label": "Print font for barcode" + }, + { + "allow_on_submit": 1, + "default": "12", + "fieldname": "print_font_size_for_barcodes", + "fieldtype": "Int", + "label": "Print font size for barcodes" + }, + { + "allow_on_submit": 1, + "default": "40", + "fieldname": "print_height_for_barcode", + "fieldtype": "Int", + "label": "Print height for barcode" + }, + { + "allow_on_submit": 1, + "default": "2", + "fieldname": "print_width_for_barcode", + "fieldtype": "Int", + "label": "Print width for barcode" + }, + { + "allow_on_submit": 1, + "default": "#000000", + "fieldname": "print_barcode_color", + "fieldtype": "Color", + "label": "Print color for barcode" } ], "icon": "fa fa-truck", "idx": 146, "is_submittable": 1, "links": [], - "modified": "2025-08-04 19:20:47.724218", + "modified": "2025-11-26 10:44:20.683630", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 453344d500db..a8dbb8d6652d 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -109,6 +109,14 @@ class DeliveryNote(SellingController): posting_time: DF.Time price_list_currency: DF.Link pricing_rules: DF.Table[PricingRuleDetail] + print_barcode_color: DF.Color | None + print_font_for_barcodes: DF.Literal[None] + print_font_size_for_barcodes: DF.Int + print_height_for_barcode: DF.Int + print_item_cost_for_barcode: DF.Check + print_item_name_for_barcode: DF.Check + print_serial_or_batch_number_for_barcode: DF.Check + print_width_for_barcode: DF.Int print_without_amount: DF.Check project: DF.Link | None represents_company: DF.Link | None diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index 23c393bbca95..1a631deb625b 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -76,6 +76,14 @@ "other_info_tab", "printing_settings", "select_print_heading", + "print_serial_or_batch_number_for_barcode", + "print_item_name_for_barcode", + "print_item_cost_for_barcode", + "print_font_for_barcodes", + "print_font_size_for_barcodes", + "print_height_for_barcode", + "print_width_for_barcode", + "print_barcode_color", "print_settings_col_break", "letter_head", "more_info", @@ -717,6 +725,63 @@ "label": "Subcontracting Inward Order", "options": "Subcontracting Inward Order", "read_only": 1 + }, + { + "allow_on_submit": 1, + "default": "1", + "fieldname": "print_serial_or_batch_number_for_barcode", + "fieldtype": "Check", + "label": "Print serial or batch number for barcode" + }, + { + "allow_on_submit": 1, + "default": "0", + "fieldname": "print_item_name_for_barcode", + "fieldtype": "Check", + "label": "Print item name for barcode" + }, + { + "default": "0", + "fieldname": "print_item_cost_for_barcode", + "fieldtype": "Check", + "label": "Print item cost for barcode", + "read_only": 1 + }, + { + "allow_on_submit": 1, + "default": "Helvetica, Arial, sans-serif", + "fieldname": "print_font_for_barcodes", + "fieldtype": "Select", + "label": "Print font for barcodes", + "options": "Helvetica, Arial, sans-serif\nArial, sans-serif\nVerdana, sans-serif\nTahoma, sans-serif\n\"Times New Roman\", Times, serif\n\"Roboto\", sans-serif\n\"Lato\", sans-serif\nConsolas, Helvetica, Arial, sans-serif" + }, + { + "allow_on_submit": 1, + "default": "12", + "fieldname": "print_font_size_for_barcodes", + "fieldtype": "Int", + "label": "Print font size for barcode" + }, + { + "allow_on_submit": 1, + "default": "40", + "fieldname": "print_height_for_barcode", + "fieldtype": "Int", + "label": "Print height for barcode" + }, + { + "allow_on_submit": 1, + "default": "2", + "fieldname": "print_width_for_barcode", + "fieldtype": "Int", + "label": "Print width for barcode" + }, + { + "allow_on_submit": 1, + "default": "#000000", + "fieldname": "print_barcode_color", + "fieldtype": "Color", + "label": "Print color for barcode" } ], "grid_page_length": 50, @@ -725,7 +790,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2025-10-13 15:09:23.905118", + "modified": "2025-11-26 11:06:46.064620", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index e67192a42998..3220b5803dfe 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -123,6 +123,14 @@ class StockEntry(StockController, SubcontractingInwardController): pick_list: DF.Link | None posting_date: DF.Date | None posting_time: DF.Time | None + print_barcode_color: DF.Color | None + print_font_for_barcodes: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] + print_font_size_for_barcodes: DF.Int + print_height_for_barcode: DF.Int + print_item_cost_for_barcode: DF.Check + print_item_name_for_barcode: DF.Check + print_serial_or_batch_number_for_barcode: DF.Check + print_width_for_barcode: DF.Int process_loss_percentage: DF.Percent process_loss_qty: DF.Float project: DF.Link | None From 906ae80819300f9d56104c874876c312da56d20b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20N=C3=A4s?= Date: Wed, 26 Nov 2025 11:34:14 +0100 Subject: [PATCH 5/7] feat: add missing select options to print_font_for_barcodes in Delivery Note --- erpnext/stock/doctype/delivery_note/delivery_note.json | 7 +++++-- erpnext/stock/doctype/delivery_note/delivery_note.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index d5e532da344a..7fb78485fc05 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -1458,9 +1458,12 @@ "label": "Print item cost for barcode" }, { + "allow_on_submit": 1, + "default": "Helvetica, Arial, sans-serif", "fieldname": "print_font_for_barcodes", "fieldtype": "Select", - "label": "Print font for barcode" + "label": "Print font for barcode", + "options": "Helvetica, Arial, sans-serif\nArial, sans-serif\nVerdana, sans-serif\nTahoma, sans-serif\n\"Times New Roman\", Times, serif\n\"Roboto\", sans-serif\n\"Lato\", sans-serif\nConsolas, Helvetica, Arial, sans-serif" }, { "allow_on_submit": 1, @@ -1495,7 +1498,7 @@ "idx": 146, "is_submittable": 1, "links": [], - "modified": "2025-11-26 10:44:20.683630", + "modified": "2025-11-26 11:27:53.828773", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index a8dbb8d6652d..84f337ec699a 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -110,7 +110,7 @@ class DeliveryNote(SellingController): price_list_currency: DF.Link pricing_rules: DF.Table[PricingRuleDetail] print_barcode_color: DF.Color | None - print_font_for_barcodes: DF.Literal[None] + print_font_for_barcodes: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] print_font_size_for_barcodes: DF.Int print_height_for_barcode: DF.Int print_item_cost_for_barcode: DF.Check From 239f975bb5c7dfbed2804019c4ba7b582cf62c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20N=C3=A4s?= Date: Wed, 26 Nov 2025 12:07:53 +0100 Subject: [PATCH 6/7] feat: correct label inconsistencies and add non-negative value validation --- .../doctype/delivery_note/delivery_note.json | 15 +++++++------ .../doctype/delivery_note/delivery_note.py | 2 +- .../purchase_receipt/purchase_receipt.json | 17 ++++++++------- .../purchase_receipt/purchase_receipt.py | 4 ++-- .../doctype/stock_entry/stock_entry.json | 21 +++++++++++-------- .../stock/doctype/stock_entry/stock_entry.py | 2 +- 6 files changed, 35 insertions(+), 26 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 7fb78485fc05..3b7c5927f7d7 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -155,7 +155,7 @@ "print_item_name_for_barcode", "print_item_cost_for_barcode", "print_font_for_barcodes", - "print_font_size_for_barcodes", + "print_font_size_for_barcode", "print_height_for_barcode", "print_width_for_barcode", "print_barcode_color", @@ -1468,23 +1468,26 @@ { "allow_on_submit": 1, "default": "12", - "fieldname": "print_font_size_for_barcodes", + "fieldname": "print_font_size_for_barcode", "fieldtype": "Int", - "label": "Print font size for barcodes" + "label": "Print font size for barcode", + "non_negative": 1 }, { "allow_on_submit": 1, "default": "40", "fieldname": "print_height_for_barcode", "fieldtype": "Int", - "label": "Print height for barcode" + "label": "Print height for barcode", + "non_negative": 1 }, { "allow_on_submit": 1, "default": "2", "fieldname": "print_width_for_barcode", "fieldtype": "Int", - "label": "Print width for barcode" + "label": "Print width for barcode", + "non_negative": 1 }, { "allow_on_submit": 1, @@ -1498,7 +1501,7 @@ "idx": 146, "is_submittable": 1, "links": [], - "modified": "2025-11-26 11:27:53.828773", + "modified": "2025-11-26 11:43:49.889049", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 84f337ec699a..f599fdb1ad8d 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -111,7 +111,7 @@ class DeliveryNote(SellingController): pricing_rules: DF.Table[PricingRuleDetail] print_barcode_color: DF.Color | None print_font_for_barcodes: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] - print_font_size_for_barcodes: DF.Int + print_font_size_for_barcode: DF.Int print_height_for_barcode: DF.Int print_item_cost_for_barcode: DF.Check print_item_name_for_barcode: DF.Check diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json index 060a3421f743..86243551446d 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json @@ -140,8 +140,8 @@ "print_serial_or_batch_number_for_barcode", "print_item_name_for_barcode", "print_item_cost_for_barcode", - "print_font_for_barcodes", - "print_font_size_for_barcodes", + "print_font_for_barcode", + "print_font_size_for_barcode", "print_height_for_barcode", "print_width_for_barcode", "print_barcode_color", @@ -1330,14 +1330,16 @@ "default": "2", "fieldname": "print_width_for_barcode", "fieldtype": "Int", - "label": "Print width for barcode" + "label": "Print width for barcode", + "non_negative": 1 }, { "allow_on_submit": 1, "default": "40", "fieldname": "print_height_for_barcode", "fieldtype": "Int", - "label": "Print height for barcode" + "label": "Print height for barcode", + "non_negative": 1 }, { "allow_on_submit": 1, @@ -1364,9 +1366,10 @@ { "allow_on_submit": 1, "default": "12", - "fieldname": "print_font_size_for_barcodes", + "fieldname": "print_font_size_for_barcode", "fieldtype": "Int", - "label": "Print font size for barcodes" + "label": "Print font size for barcode", + "non_negative": 1 } ], "grid_page_length": 50, @@ -1374,7 +1377,7 @@ "idx": 261, "is_submittable": 1, "links": [], - "modified": "2025-11-25 17:49:40.664691", + "modified": "2025-11-26 11:44:48.672855", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 5b468b55e79a..18f2efd22f6a 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -104,8 +104,8 @@ class PurchaseReceipt(BuyingController): price_list_currency: DF.Link | None pricing_rules: DF.Table[PricingRuleDetail] print_barcode_color: DF.Color | None - print_font_for_barcodes: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] - print_font_size_for_barcodes: DF.Int + print_font_for_barcode: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] + print_font_size_for_barcode: DF.Int print_height_for_barcode: DF.Int print_item_cost_for_barcode: DF.Check print_item_name_for_barcode: DF.Check diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index 1a631deb625b..d1503ca25953 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -79,8 +79,8 @@ "print_serial_or_batch_number_for_barcode", "print_item_name_for_barcode", "print_item_cost_for_barcode", - "print_font_for_barcodes", - "print_font_size_for_barcodes", + "print_font_for_barcode", + "print_font_size_for_barcode", "print_height_for_barcode", "print_width_for_barcode", "print_barcode_color", @@ -750,31 +750,34 @@ { "allow_on_submit": 1, "default": "Helvetica, Arial, sans-serif", - "fieldname": "print_font_for_barcodes", + "fieldname": "print_font_for_barcode", "fieldtype": "Select", - "label": "Print font for barcodes", + "label": "Print font for barcode", "options": "Helvetica, Arial, sans-serif\nArial, sans-serif\nVerdana, sans-serif\nTahoma, sans-serif\n\"Times New Roman\", Times, serif\n\"Roboto\", sans-serif\n\"Lato\", sans-serif\nConsolas, Helvetica, Arial, sans-serif" }, { "allow_on_submit": 1, "default": "12", - "fieldname": "print_font_size_for_barcodes", + "fieldname": "print_font_size_for_barcode", "fieldtype": "Int", - "label": "Print font size for barcode" + "label": "Print font size for barcode", + "non_negative": 1 }, { "allow_on_submit": 1, "default": "40", "fieldname": "print_height_for_barcode", "fieldtype": "Int", - "label": "Print height for barcode" + "label": "Print height for barcode", + "non_negative": 1 }, { "allow_on_submit": 1, "default": "2", "fieldname": "print_width_for_barcode", "fieldtype": "Int", - "label": "Print width for barcode" + "label": "Print width for barcode", + "non_negative": 1 }, { "allow_on_submit": 1, @@ -790,7 +793,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2025-11-26 11:06:46.064620", + "modified": "2025-11-26 11:44:16.299566", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 3220b5803dfe..5c67dbb3561b 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -124,7 +124,7 @@ class StockEntry(StockController, SubcontractingInwardController): posting_date: DF.Date | None posting_time: DF.Time | None print_barcode_color: DF.Color | None - print_font_for_barcodes: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] + print_font_for_barcode: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] print_font_size_for_barcodes: DF.Int print_height_for_barcode: DF.Int print_item_cost_for_barcode: DF.Check From 18e782230a902b29c35471cd9d54efb98db64b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20N=C3=A4s?= Date: Wed, 26 Nov 2025 19:54:29 +0100 Subject: [PATCH 7/7] fix: simplify font families in select to not cause linting errors --- .../stock/doctype/delivery_note/delivery_note.json | 10 +++++----- .../stock/doctype/delivery_note/delivery_note.py | 2 +- .../doctype/purchase_receipt/purchase_receipt.json | 13 +++++++------ .../doctype/purchase_receipt/purchase_receipt.py | 2 +- erpnext/stock/doctype/stock_entry/stock_entry.json | 6 +++--- erpnext/stock/doctype/stock_entry/stock_entry.py | 4 ++-- .../print_formats/includes/batch_no_barcodes.html | 4 ++-- .../includes/serial_and_batch_no_barcodes.html | 4 ++-- .../print_formats/includes/serial_no_barcodes.html | 4 ++-- 9 files changed, 25 insertions(+), 24 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 3b7c5927f7d7..c29b591979d7 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -154,7 +154,7 @@ "print_serial_or_batch_number_for_barcode", "print_item_name_for_barcode", "print_item_cost_for_barcode", - "print_font_for_barcodes", + "print_font_for_barcode", "print_font_size_for_barcode", "print_height_for_barcode", "print_width_for_barcode", @@ -1459,11 +1459,11 @@ }, { "allow_on_submit": 1, - "default": "Helvetica, Arial, sans-serif", - "fieldname": "print_font_for_barcodes", + "default": "Helvetica", + "fieldname": "print_font_for_barcode", "fieldtype": "Select", "label": "Print font for barcode", - "options": "Helvetica, Arial, sans-serif\nArial, sans-serif\nVerdana, sans-serif\nTahoma, sans-serif\n\"Times New Roman\", Times, serif\n\"Roboto\", sans-serif\n\"Lato\", sans-serif\nConsolas, Helvetica, Arial, sans-serif" + "options": "Helvetica\nArial\nVerdana\nsans-serif\nTahoma\nTimes\nConsolas" }, { "allow_on_submit": 1, @@ -1501,7 +1501,7 @@ "idx": 146, "is_submittable": 1, "links": [], - "modified": "2025-11-26 11:43:49.889049", + "modified": "2025-11-26 18:18:05.926334", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index f599fdb1ad8d..5078ea28855e 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -110,7 +110,7 @@ class DeliveryNote(SellingController): price_list_currency: DF.Link pricing_rules: DF.Table[PricingRuleDetail] print_barcode_color: DF.Color | None - print_font_for_barcodes: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] + print_font_for_barcode: DF.Literal["Helvetica", "Arial", "Verdana", "sans-serif", "Tahoma", "Times", "Consolas"] print_font_size_for_barcode: DF.Int print_height_for_barcode: DF.Int print_item_cost_for_barcode: DF.Check diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json index 86243551446d..dd8a5d55a6e0 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json @@ -1343,11 +1343,11 @@ }, { "allow_on_submit": 1, - "default": "Helvetica, Arial, sans-serif", - "fieldname": "print_font_for_barcodes", + "default": "Helvetica", + "fieldname": "print_font_for_barcode", "fieldtype": "Select", - "label": "Print font for barcodes", - "options": "Helvetica, Arial, sans-serif\nArial, sans-serif\nVerdana, sans-serif\nTahoma, sans-serif\n\"Times New Roman\", Times, serif\n\"Roboto\", sans-serif\n\"Lato\", sans-serif\nConsolas, Helvetica, Arial, sans-serif" + "label": "Print font for barcode", + "options": "Helvetica\nArial\nVerdana\nsans-serif\nTahoma\nTimes\nConsolas" }, { "allow_on_submit": 1, @@ -1369,7 +1369,8 @@ "fieldname": "print_font_size_for_barcode", "fieldtype": "Int", "label": "Print font size for barcode", - "non_negative": 1 + "non_negative": 1, + "options": "Helvetica" } ], "grid_page_length": 50, @@ -1377,7 +1378,7 @@ "idx": 261, "is_submittable": 1, "links": [], - "modified": "2025-11-26 11:44:48.672855", + "modified": "2025-11-26 18:17:30.100779", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 18f2efd22f6a..62d139068719 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -104,7 +104,7 @@ class PurchaseReceipt(BuyingController): price_list_currency: DF.Link | None pricing_rules: DF.Table[PricingRuleDetail] print_barcode_color: DF.Color | None - print_font_for_barcode: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] + print_font_for_barcode: DF.Literal["Helvetica", "Arial", "Verdana", "sans-serif", "Tahoma", "Times", "Consolas"] print_font_size_for_barcode: DF.Int print_height_for_barcode: DF.Int print_item_cost_for_barcode: DF.Check diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index d1503ca25953..c2e5dc7878f4 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -749,11 +749,11 @@ }, { "allow_on_submit": 1, - "default": "Helvetica, Arial, sans-serif", + "default": "Helvetica", "fieldname": "print_font_for_barcode", "fieldtype": "Select", "label": "Print font for barcode", - "options": "Helvetica, Arial, sans-serif\nArial, sans-serif\nVerdana, sans-serif\nTahoma, sans-serif\n\"Times New Roman\", Times, serif\n\"Roboto\", sans-serif\n\"Lato\", sans-serif\nConsolas, Helvetica, Arial, sans-serif" + "options": "Helvetica\nArial\nVerdana\nsans-serif\nTahoma\nTimes\nConsolas" }, { "allow_on_submit": 1, @@ -793,7 +793,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2025-11-26 11:44:16.299566", + "modified": "2025-11-26 18:18:35.153837", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 5c67dbb3561b..7b16559da6b3 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -124,8 +124,8 @@ class StockEntry(StockController, SubcontractingInwardController): posting_date: DF.Date | None posting_time: DF.Time | None print_barcode_color: DF.Color | None - print_font_for_barcode: DF.Literal["Helvetica, Arial, sans-serif", "Arial, sans-serif", "Verdana, sans-serif", "Tahoma, sans-serif", "\"Times New Roman\", Times, serif", "\"Roboto\", sans-serif", "\"Lato\", sans-serif", "Consolas, Helvetica, Arial, sans-serif"] - print_font_size_for_barcodes: DF.Int + print_font_for_barcode: DF.Literal["Helvetica", "Arial", "Verdana", "sans-serif", "Tahoma", "Times", "Consolas"] + print_font_size_for_barcode: DF.Int print_height_for_barcode: DF.Int print_item_cost_for_barcode: DF.Check print_item_name_for_barcode: DF.Check diff --git a/erpnext/templates/print_formats/includes/batch_no_barcodes.html b/erpnext/templates/print_formats/includes/batch_no_barcodes.html index 2992f90864f1..4ff78097a291 100644 --- a/erpnext/templates/print_formats/includes/batch_no_barcodes.html +++ b/erpnext/templates/print_formats/includes/batch_no_barcodes.html @@ -1,8 +1,8 @@ diff --git a/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html b/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html index 368230ded0fc..b0318778dfcd 100644 --- a/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html +++ b/erpnext/templates/print_formats/includes/serial_and_batch_no_barcodes.html @@ -1,8 +1,8 @@ diff --git a/erpnext/templates/print_formats/includes/serial_no_barcodes.html b/erpnext/templates/print_formats/includes/serial_no_barcodes.html index 54c892eab7c1..eb573c5c8b93 100644 --- a/erpnext/templates/print_formats/includes/serial_no_barcodes.html +++ b/erpnext/templates/print_formats/includes/serial_no_barcodes.html @@ -1,8 +1,8 @@
+ + {% for d in bundle_data %} {% if d.batch_no %}
{% if doc.print_item_name_for_barcode %} -
- {{ row.item_name }} -
- {% endif %} +
+ {{ row.item_name }} +
+ {% endif %} - {% if doc.print_item_cost_for_barcode %} -
- {{ row.rate }} {{ doc.currency }} -
- {% endif %} + {% if doc.print_item_cost_for_barcode %} +
+ {{ row.rate }} {{ doc.currency }} +
+ {% endif %} - - - {% if doc.print_serial_or_batch_number_for_barcode %} -
- {{ d.batch_no }} -
- {% endif %} + + + {% if doc.print_serial_or_batch_number_for_barcode %} +
+ {{ d.batch_no }} +
+ {% endif %}
{% endif %} -
+ {% endfor %} + + {% for d in bundle_data %} {% if d.serial_no %}
{% if doc.print_item_name_for_barcode %}
- {{ row.item_name }} + {{ row.item_name }}
{% endif %} @@ -87,8 +89,8 @@ {% endif %}
{% endif %} -