brotherton-erpnext/erpnext/controllers/print_settings.py
Chillar Anand 915b34391c
chore: Clean up imports (#27302)
* chore: Added isort to pre-commit config

* chore: Sort imports with isort

* chore: Clean up imports with pycln

* chore: Sort imports with isort

* chore: Fix import issues

* chore: Clean up sider issues

* chore: Remove import errors from flake8 ignore list

* chore: Clean up lint issues
2021-09-02 16:44:59 +05:30

42 lines
1.3 KiB
Python

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def set_print_templates_for_item_table(doc, settings):
doc.print_templates = {
"items": "templates/print_formats/includes/items.html",
}
doc.child_print_templates = {
"items": {
"qty": "templates/print_formats/includes/item_table_qty.html",
}
}
if doc.meta.get_field("items"):
doc.meta.get_field("items").hide_in_print_layout = ["uom", "stock_uom"]
doc.flags.compact_item_fields = ["description", "qty", "rate", "amount"]
if settings.compact_item_print:
doc.child_print_templates["items"]["description"] =\
"templates/print_formats/includes/item_table_description.html"
doc.flags.format_columns = format_columns
def set_print_templates_for_taxes(doc, settings):
doc.flags.show_inclusive_tax_in_print = doc.is_inclusive_tax()
doc.print_templates.update({
"total": "templates/print_formats/includes/total.html",
"taxes": "templates/print_formats/includes/taxes.html"
})
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