From 38aa7cab8ae2c94cf95ff5ae2275acd895d9536c 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] 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 | 5 +- .../sales_invoice_print/__init__.py | 0 .../sales_invoice_print.html | 161 ++++++++++++++++++ .../sales_invoice_print.json | 32 ++++ 4 files changed, 197 insertions(+), 1 deletion(-) 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 6f32571c25f..4f9f4ef220c 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -3,6 +3,7 @@ "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": [ @@ -2201,6 +2202,7 @@ "print_hide": 1 } ], + "grid_page_length": 50, "icon": "fa fa-file-text", "idx": 181, "is_submittable": 1, @@ -2211,7 +2213,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", @@ -2257,6 +2259,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, "sort_field": "creation", 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..d4acf5fb36e --- /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" +} \ No newline at end of file