brotherton-erpnext/erpnext/controllers/print_settings.py

29 lines
1023 B
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
2018-08-08 11:07:31 +00:00
doc.flags.compact_item_print = cint(frappe.db.get_single_value("Print Settings", "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.flags.compact_item_fields = ["description", "qty", "rate", "amount"]
doc.flags.format_columns = format_columns
def format_columns(display_columns, compact_fields):
compact_fields = compact_fields + ["image", "item_code", "item_name"]
final_columns = []
for column in display_columns:
if column not in compact_fields:
final_columns.append(column)
return final_columns