diff --git a/erpnext/controllers/print_settings.py b/erpnext/controllers/print_settings.py index c5f8e0794ab..bc34f7c6b37 100644 --- a/erpnext/controllers/print_settings.py +++ b/erpnext/controllers/print_settings.py @@ -1,9 +1,29 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt +from __future__ import unicode_literals +import frappe +from frappe.utils import cint + def print_settings_for_item_table(doc): + doc.print_templates = { "description": "templates/print_formats/includes/item_table_description.html", "qty": "templates/print_formats/includes/item_table_qty.html" } + doc.hide_in_print_layout = ["item_code", "item_name", "image", "uom", "stock_uom"] + + doc.flags.compact_item_print = cint(frappe.db.get_value("Features Setup", None, "compact_item_print")) + doc.flags.compact_item_fields = doc.hide_in_print_layout + ["description", "qty", "rate", "amount"] + doc.flags.show_in_description = [] + + if doc.flags.compact_item_print: + for df in doc.meta.fields: + if df.fieldtype not in ("Section Break", "Column Break", "Button"): + if not doc.is_print_hide(df.fieldname): + if df.fieldname not in doc.hide_in_print_layout and df.fieldname not in doc.flags.compact_item_fields: + doc.hide_in_print_layout.append(df.fieldname) + doc.flags.show_in_description.append(df.fieldname) + + diff --git a/erpnext/setup/doctype/features_setup/features_setup.js b/erpnext/setup/doctype/features_setup/features_setup.js new file mode 100644 index 00000000000..a637a8e785a --- /dev/null +++ b/erpnext/setup/doctype/features_setup/features_setup.js @@ -0,0 +1,5 @@ +frappe.ui.form.on('Features Setup', { + refresh: function(frm) { + + } +}); diff --git a/erpnext/setup/doctype/features_setup/features_setup.json b/erpnext/setup/doctype/features_setup/features_setup.json index 217a23ab9ff..8dea3398172 100644 --- a/erpnext/setup/doctype/features_setup/features_setup.json +++ b/erpnext/setup/doctype/features_setup/features_setup.json @@ -18,9 +18,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Materials", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -40,9 +42,11 @@ "in_filter": 0, "in_list_view": 1, "label": "Item Serial Nos", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -62,9 +66,11 @@ "in_filter": 0, "in_list_view": 1, "label": "Item Batch Nos", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -84,9 +90,11 @@ "in_filter": 0, "in_list_view": 1, "label": "Brands", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -106,9 +114,11 @@ "in_filter": 0, "in_list_view": 1, "label": "Item Barcode", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -126,9 +136,11 @@ "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -140,7 +152,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "description": "1. To maintain the customer wise item code and to make them searchable based on their code use this option", + "description": "To maintain the customer wise item code and to make them searchable based on their code use this option", "fieldname": "fs_item_advanced", "fieldtype": "Check", "hidden": 0, @@ -148,9 +160,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Item Advanced", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -170,9 +184,36 @@ "in_filter": 0, "in_list_view": 0, "label": "Item Groups in Details", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "description": "If checked, only Description, Quantity, Rate and Amount are shown in print of Item table. Any extra field is shown under 'Description' column.", + "fieldname": "compact_item_print", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Compact Item Print", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -191,9 +232,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Sales and Purchase", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -213,9 +256,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Exports", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -235,9 +280,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Imports", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -255,9 +302,11 @@ "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -277,9 +326,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Sales Discounts", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -299,9 +350,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Purchase Discounts", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -321,9 +374,11 @@ "in_filter": 0, "in_list_view": 0, "label": "After Sale Installations", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -343,9 +398,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Projects", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -365,9 +422,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Sales Extras", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -386,9 +445,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Accounts", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -408,9 +469,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Recurring Invoice", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -428,9 +491,11 @@ "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -450,9 +515,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Point of Sale", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -472,9 +539,11 @@ "in_filter": 0, "in_list_view": 0, "label": "POS View", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -493,9 +562,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Manufacturing", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -515,9 +586,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Manufacturing", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -535,9 +608,11 @@ "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -557,9 +632,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Quality", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -578,9 +655,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Miscelleneous", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -600,9 +679,11 @@ "in_filter": 0, "in_list_view": 0, "label": "Page Break", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -620,9 +701,11 @@ "ignore_user_permissions": 0, "in_filter": 0, "in_list_view": 0, + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -641,9 +724,11 @@ "in_filter": 0, "in_list_view": 0, "label": "More Information", + "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -661,7 +746,8 @@ "is_submittable": 0, "issingle": 1, "istable": 0, - "modified": "2015-08-27 03:27:35.694800", + "max_attachments": 0, + "modified": "2016-02-16 04:43:32.144944", "modified_by": "Administrator", "module": "Setup", "name": "Features Setup", @@ -710,5 +796,6 @@ } ], "read_only": 0, - "read_only_onload": 0 + "read_only_onload": 0, + "sort_order": "ASC" } \ No newline at end of file diff --git a/erpnext/templates/print_formats/includes/item_table_description.html b/erpnext/templates/print_formats/includes/item_table_description.html index 116523ca044..a9f7bcce4a3 100644 --- a/erpnext/templates/print_formats/includes/item_table_description.html +++ b/erpnext/templates/print_formats/includes/item_table_description.html @@ -1,25 +1,46 @@ +{%- set compact = doc.flags.compact_item_print -%} +{%- set compact_fields = doc.flags.compact_item_fields -%} + {% if doc.in_format_data("image") and doc.get("image") and not doc.is_print_hide("image")-%}
{{ doc.get_formatted("description") }}
- {%- endif %} +{{ doc.get_formatted("description") }}
+ {%- endif %} + + {% if compact -%} + {%- for fieldname in doc.flags.show_in_description -%} + {% if doc.get(fieldname) -%} ++ {{ doc.meta.get_label(fieldname) }}: + {{ doc.get_formatted(fieldname) }} +
+ {% endif %} + {%- endfor -%} + {%- endif %}