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
|
|
|
|
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2020-10-29 08:49:34 +00:00
|
|
|
def set_print_templates_for_item_table(doc, settings):
|
2015-02-04 11:32:24 +00:00
|
|
|
doc.print_templates = {
|
2020-10-29 08:49:34 +00:00
|
|
|
"items": "templates/print_formats/includes/items.html",
|
2015-02-04 11:32:24 +00:00
|
|
|
}
|
2016-02-09 08:45:51 +00:00
|
|
|
|
2020-10-29 08:49:34 +00:00
|
|
|
doc.child_print_templates = {
|
|
|
|
"items": {
|
|
|
|
"qty": "templates/print_formats/includes/item_table_qty.html",
|
2023-06-26 10:30:53 +00:00
|
|
|
"serial_and_batch_bundle": "templates/print_formats/includes/serial_and_batch_bundle.html",
|
2020-10-29 08:49:34 +00:00
|
|
|
}
|
|
|
|
}
|
2016-02-09 08:45:51 +00:00
|
|
|
|
2020-10-29 08:49:34 +00:00
|
|
|
if doc.meta.get_field("items"):
|
|
|
|
doc.meta.get_field("items").hide_in_print_layout = ["uom", "stock_uom"]
|
2016-03-07 12:52:40 +00:00
|
|
|
|
2020-10-29 08:49:34 +00:00
|
|
|
doc.flags.compact_item_fields = ["description", "qty", "rate", "amount"]
|
2020-10-22 11:49:00 +00:00
|
|
|
|
2020-10-29 08:49:34 +00:00
|
|
|
if settings.compact_item_print:
|
2022-03-28 13:22:46 +00:00
|
|
|
doc.child_print_templates["items"][
|
|
|
|
"description"
|
|
|
|
] = "templates/print_formats/includes/item_table_description.html"
|
2020-10-29 08:49:34 +00:00
|
|
|
doc.flags.format_columns = format_columns
|
2020-10-22 11:49:00 +00:00
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2020-10-29 08:49:34 +00:00
|
|
|
def set_print_templates_for_taxes(doc, settings):
|
2020-10-22 10:07:47 +00:00
|
|
|
doc.flags.show_inclusive_tax_in_print = doc.is_inclusive_tax()
|
2022-03-28 13:22:46 +00:00
|
|
|
doc.print_templates.update(
|
|
|
|
{
|
|
|
|
"total": "templates/print_formats/includes/total.html",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2023-06-13 14:12:56 +00:00
|
|
|
if not doc.should_show_taxes_as_table_in_print():
|
|
|
|
doc.print_templates.update(
|
|
|
|
{
|
|
|
|
"taxes": "templates/print_formats/includes/taxes.html",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2020-10-22 11:49:00 +00:00
|
|
|
|
2017-01-25 00:20:43 +00:00
|
|
|
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
|