brotherton-erpnext/erpnext/controllers/print_settings.py

30 lines
1.2 KiB
Python
Raw Normal View History

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
2016-02-09 08:45:51 +00:00
from __future__ import unicode_literals
import frappe
from frappe.utils import cint
def print_settings_for_item_table(doc):
2016-02-16 10:00:17 +00:00
doc.print_templates = {
"qty": "templates/print_formats/includes/item_table_qty.html"
}
doc.hide_in_print_layout = ["uom", "stock_uom"]
2016-02-09 08:45:51 +00:00
2016-02-16 10:00:17 +00:00
doc.flags.compact_item_print = cint(frappe.db.get_value("Features Setup", None, "compact_item_print"))
2016-02-09 08:45:51 +00:00
2016-02-16 10:00:17 +00:00
if doc.flags.compact_item_print:
doc.print_templates["description"] = "templates/print_formats/includes/item_table_description.html"
doc.hide_in_print_layout += ["item_code", "item_name", "image"]
doc.flags.compact_item_fields = ["description", "qty", "rate", "amount"]
doc.flags.show_in_description = []
2016-02-09 08:45:51 +00:00
for df in doc.meta.fields:
if df.fieldtype not in ("Section Break", "Column Break", "Button"):
if not doc.is_print_hide(df.fieldname):
2016-02-16 10:00:17 +00:00
if df.fieldname not in doc.hide_in_print_layout and df.fieldname not in doc.flags.compact_item_fields:
2016-02-09 08:45:51 +00:00
doc.hide_in_print_layout.append(df.fieldname)
2016-02-16 10:00:17 +00:00
doc.flags.show_in_description.append(df.fieldname)