From 225cbd82baefc9dbff90aa406b22165c41777fd6 Mon Sep 17 00:00:00 2001 From: Ejaaz Khan <67804911+iamejaaz@users.noreply.github.com> Date: Wed, 5 Mar 2025 18:06:59 +0530 Subject: [PATCH 1/2] feat: create sales invoice print format (#45403) * feat: create sales invoice print format * fix: linter issue * style: remove border from table * refactor: change label to uppercase and show taxes * refactor: format date and add translation on label * refactor: remove default header and format labels * refactor: change label style and small fix * chore: Qty in title case --------- Co-authored-by: Nabin Hait --- .../doctype/sales_invoice/sales_invoice.json | 9 +- .../sales_invoice_print/__init__.py | 0 .../sales_invoice_print.html | 161 ++++++++++++++++++ .../sales_invoice_print.json | 32 ++++ 4 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 erpnext/accounts/print_format/sales_invoice_print/__init__.py create mode 100644 erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.html create mode 100644 erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.json diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 382aeb80166..a99aa4e9dea 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -3,7 +3,8 @@ "allow_auto_repeat": 1, "allow_import": 1, "autoname": "naming_series:", - "creation": "2013-05-24 19:29:05", + "creation": "2022-01-25 10:29:57.771398", + "default_print_format": "Sales Invoice Print", "doctype": "DocType", "engine": "InnoDB", "field_order": [ @@ -1939,7 +1940,8 @@ "print_hide": 1 } ], - "icon": "uil uil-file-alt", + "grid_page_length": 50, + "icon": "fa fa-file-text", "idx": 181, "index_web_pages_for_search": 1, "is_sealed": 1, @@ -1951,7 +1953,7 @@ "link_fieldname": "consolidated_invoice" } ], - "modified": "2025-02-06 15:59:54.636202", + "modified": "2025-03-05 17:06:59.720616", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", @@ -1998,6 +2000,7 @@ } ], "quick_entry": 1, + "row_format": "Dynamic", "search_fields": "posting_date, due_date, customer, base_grand_total, outstanding_amount", "show_name_in_global_search": 1, "show_preview_popup": 1, diff --git a/erpnext/accounts/print_format/sales_invoice_print/__init__.py b/erpnext/accounts/print_format/sales_invoice_print/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.html b/erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.html new file mode 100644 index 00000000000..958c5c10fc1 --- /dev/null +++ b/erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.html @@ -0,0 +1,161 @@ +{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead, footer, print_settings=None, print_heading_template=None) -%} + {% if letter_head and not no_letterhead %} +
{{ letter_head }}
+ {% endif %} + {% if print_heading_template %} + {{ frappe.render_template(print_heading_template, {"doc":doc}) }} + {% else %} + {% endif %} + {%- if doc.meta.is_submittable and doc.docstatus==2-%} +
+

{{ _("CANCELLED") }}

+
+ {%- endif -%} +{%- endmacro -%} +{% for page in layout %} +
+
+ {{ add_header(loop.index, layout|len, doc, letter_head, no_letterhead, footer, print_settings) }} +
+ + + {% if print_settings.repeat_header_footer %} + + {% endif %} + +
+
+
{{ doc.customer }}
+
+ {{ doc.address_display }} +
+
+ {{ _("Conatct: ")+doc.contact_display if doc.contact_display else '' }} +
+
+ {{ _("Mobile: ")+doc.contact_mobile if doc.contact_mobile else '' }} +
+
+
+
+
+
+
{{ doc.name }}
+
+
+
+
{{ frappe.utils.format_date(doc.posting_date) }}
+
+
+
+
{{ frappe.utils.format_date(doc.due_date) }}
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + {% for item in doc.items %} + + + + + + + + {% endfor %} +
{{ _("Sr") }}{{ _("Details") }}{{ _("Qty") }}{{ _("Rate") }}{{ _("Amount") }}
{{ loop.index }} + {{ item.item_code }}: {{ item.item_name }} + {% if (item.description != item.item_name) %} +
{{ item.description }} + {% endif %} +
+ {{ item.get_formatted("qty", 0) }} + {{ item.get_formatted("uom", 0) }} + {{ item.get_formatted("net_rate", doc) }}{{ item.get_formatted("net_amount", doc) }}
+ +
+ +
+
+ + {{ doc.in_words }} +
+
+ + {{ doc.status }} +
+
+
+
+
{{ _("Sub Total") }}
+
{{ doc.get_formatted("net_total", doc) }}
+
+
+ {% for d in doc.taxes %} + {% if d.tax_amount %} +
+
{{ _(d.description) }}
+
{{ d.get_formatted("tax_amount") }}
+
+ {% endif %} + {% endfor %} +
+
+
{{ _("Total") }}
+
{{ doc.get_formatted("grand_total", doc) }}
+
+
+ +
+
+ + +
+
+
+
+
{{ doc.terms if doc.terms else '' }}
+
+
+
+
+{% endfor %} diff --git a/erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.json b/erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.json new file mode 100644 index 00000000000..e5a47b9ce1d --- /dev/null +++ b/erpnext/accounts/print_format/sales_invoice_print/sales_invoice_print.json @@ -0,0 +1,32 @@ +{ + "absolute_value": 0, + "align_labels_right": 0, + "creation": "2025-01-22 16:23:51.012200", + "css": "", + "custom_format": 0, + "default_print_language": "en", + "disabled": 0, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Print Format", + "font": "", + "font_size": 14, + "idx": 0, + "line_breaks": 0, + "margin_bottom": 0.0, + "margin_left": 0.0, + "margin_right": 0.0, + "margin_top": 0.0, + "modified": "2025-01-22 16:23:51.012200", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Sales Invoice Print", + "owner": "Administrator", + "page_number": "Hide", + "print_format_builder": 0, + "print_format_builder_beta": 0, + "print_format_type": "Jinja", + "raw_printing": 0, + "show_section_headings": 0, + "standard": "Yes" +} -- GitLab From 26345dec8cca342ae9853492dd862d371fa8ae08 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Thu, 6 Mar 2025 08:38:25 +0100 Subject: [PATCH 2/2] fix: remove default print format --- erpnext/accounts/doctype/sales_invoice/sales_invoice.json | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index a99aa4e9dea..bb360e84cd3 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -4,7 +4,6 @@ "allow_import": 1, "autoname": "naming_series:", "creation": "2022-01-25 10:29:57.771398", - "default_print_format": "Sales Invoice Print", "doctype": "DocType", "engine": "InnoDB", "field_order": [ -- GitLab