blob: 7c00e64529a2b314c30e4d3248c87b64be93cd02 [file] [log] [blame]
Anand Doshi885e0742015-03-03 14:55:30 +05301# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
Rushabh Mehta0e132212015-02-04 17:02:24 +05302# License: GNU General Public License v3. See license.txt
3
ShashaQin429ab202016-02-09 16:45:51 +08004from __future__ import unicode_literals
5import frappe
6from frappe.utils import cint
7
Rushabh Mehta0e132212015-02-04 17:02:24 +05308def print_settings_for_item_table(doc):
ShashaQin429ab202016-02-09 16:45:51 +08009
Rushabh Mehta0e132212015-02-04 17:02:24 +053010 doc.print_templates = {
11 "description": "templates/print_formats/includes/item_table_description.html",
12 "qty": "templates/print_formats/includes/item_table_qty.html"
13 }
ShashaQinfd087502016-02-12 09:22:05 +080014 compact_item_view = cint(frappe.db.get_value("Features Setup", None, "compact_item_view"))
ShashaQin429ab202016-02-09 16:45:51 +080015
Rushabh Mehta0e132212015-02-04 17:02:24 +053016 doc.hide_in_print_layout = ["item_code", "item_name", "image", "uom", "stock_uom"]
ShashaQin429ab202016-02-09 16:45:51 +080017
18 std_fields = ["item_code", "item_name", "description", "qty", "rate", "amount", "stock_uom", "uom"]
19
ShashaQinfd087502016-02-12 09:22:05 +080020 if compact_item_view:
ShashaQin429ab202016-02-09 16:45:51 +080021
22 for df in doc.meta.fields:
23 if df.fieldtype not in ("Section Break", "Column Break", "Button"):
24 if not doc.is_print_hide(df.fieldname):
25 if df.fieldname not in doc.hide_in_print_layout and df.fieldname not in std_fields:
26 doc.hide_in_print_layout.append(df.fieldname)
27
28