2015-03-03 09:25:30 +00:00
|
|
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2015-02-04 11:32:24 +00:00
|
|
|
# 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
|
|
|
|
|
2015-02-04 11:32:24 +00:00
|
|
|
def print_settings_for_item_table(doc):
|
2016-02-16 10:00:17 +00:00
|
|
|
|
2015-02-04 11:32:24 +00:00
|
|
|
doc.print_templates = {
|
|
|
|
"qty": "templates/print_formats/includes/item_table_qty.html"
|
|
|
|
}
|
2016-03-07 12:52:40 +00:00
|
|
|
doc.hide_in_print_layout = ["uom", "stock_uom"]
|
2016-02-09 08:45:51 +00:00
|
|
|
|
2016-05-11 11:17:14 +00:00
|
|
|
doc.flags.compact_item_print = cint(frappe.db.get_value("Print Settings", 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:
|
2016-03-07 12:52:40 +00:00
|
|
|
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)
|