From 28804bfb62e338aad22ccb6b00b908966cf2319e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 16 Jul 2014 18:18:34 +0530 Subject: [PATCH] started sales order print format (new style) --- .../doctype/sales_order/sales_order.json | 108 +++++++++--------- .../doctype/sales_order/sales_order.py | 4 + .../print_formats/includes/item_grid.html | 31 +++++ .../print_formats/includes/taxes.html | 17 +++ 4 files changed, 109 insertions(+), 51 deletions(-) create mode 100644 erpnext/templates/print_formats/includes/item_grid.html create mode 100644 erpnext/templates/print_formats/includes/taxes.html diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index bb5211312c..6cc7b83c3d 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -223,7 +223,8 @@ "fieldtype": "Section Break", "label": "Currency and Price List", "options": "icon-tag", - "permlevel": 0 + "permlevel": 0, + "print_hide": 1 }, { "fieldname": "currency", @@ -341,6 +342,16 @@ "fieldtype": "Section Break", "permlevel": 0 }, + { + "fieldname": "column_break_33a", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "column_break_33", + "fieldtype": "Column Break", + "permlevel": 0 + }, { "fieldname": "net_total_export", "fieldtype": "Currency", @@ -349,11 +360,6 @@ "permlevel": 0, "read_only": 1 }, - { - "fieldname": "column_break_33", - "fieldtype": "Column Break", - "permlevel": 0 - }, { "fieldname": "net_total", "fieldtype": "Currency", @@ -469,50 +475,6 @@ "permlevel": 0, "print_hide": 1 }, - { - "fieldname": "grand_total_export", - "fieldtype": "Currency", - "label": "Grand Total", - "oldfieldname": "grand_total_export", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "reqd": 0, - "width": "150px" - }, - { - "fieldname": "rounded_total_export", - "fieldtype": "Currency", - "label": "Rounded Total", - "oldfieldname": "rounded_total_export", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "width": "150px" - }, - { - "fieldname": "in_words_export", - "fieldtype": "Data", - "label": "In Words", - "oldfieldname": "in_words_export", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "width": "200px" - }, - { - "fieldname": "column_break3", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, - "width": "50%" - }, { "fieldname": "grand_total", "fieldtype": "Currency", @@ -550,6 +512,50 @@ "read_only": 1, "width": "200px" }, + { + "fieldname": "column_break3", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "width": "50%" + }, + { + "fieldname": "grand_total_export", + "fieldtype": "Currency", + "label": "Grand Total", + "oldfieldname": "grand_total_export", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "reqd": 0, + "width": "150px" + }, + { + "fieldname": "rounded_total_export", + "fieldtype": "Currency", + "label": "Rounded Total", + "oldfieldname": "rounded_total_export", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "width": "150px" + }, + { + "fieldname": "in_words_export", + "fieldtype": "Data", + "label": "In Words", + "oldfieldname": "in_words_export", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "width": "200px" + }, { "fieldname": "terms_section_break", "fieldtype": "Section Break", @@ -883,7 +889,7 @@ "idx": 1, "is_submittable": 1, "issingle": 0, - "modified": "2014-07-10 02:43:45.504009", + "modified": "2014-07-16 16:32:16.459587", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index e0a7a1d62d..9a26404962 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -18,6 +18,10 @@ class SalesOrder(SellingController): person_tname = 'Target Detail' partner_tname = 'Partner Target Detail' territory_tname = 'Territory Target Detail' + table_print_templates = { + "sales_order_details": "templates/print_formats/includes/item_grid.html", + "other_charges": "templates/print_formats/includes/taxes.html", + } def validate_mandatory(self): # validate transaction date v/s delivery date diff --git a/erpnext/templates/print_formats/includes/item_grid.html b/erpnext/templates/print_formats/includes/item_grid.html new file mode 100644 index 0000000000..2ca4289b55 --- /dev/null +++ b/erpnext/templates/print_formats/includes/item_grid.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + {%- for row in data -%} + + + + + + + + + + {%- endfor -%} + +
SrItem NameDescriptionQtyUoMBasic RateAmount
{{ row.idx }} + {{ row.item_name }} + {% if row.item_code != row.item_name -%} +
Item Code: {{ row.item_code}} + {%- endif %} +
+
{{ row.description }}
{{ row.qty }}{{ row.stock_uom }}{{ + format(row.rate, table_meta.get_field("rate"), doc) }}{{ format(row.amount, table_meta.get_field("amount"), doc) }}
diff --git a/erpnext/templates/print_formats/includes/taxes.html b/erpnext/templates/print_formats/includes/taxes.html new file mode 100644 index 0000000000..e23b49cb9b --- /dev/null +++ b/erpnext/templates/print_formats/includes/taxes.html @@ -0,0 +1,17 @@ +
+
+
+ {%- for charge in data -%} + {%- if not charge.included_in_print_rate -%} +
+
+
+
+ {{ format(charge.tax_amount / doc.conversion_rate, + table_meta.get_field("tax_amount"), doc) }} +
+
+ {%- endif -%} + {%- endfor -%} +
+