You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

45 lines
1.3 KiB

  1. # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
  2. # License: GNU General Public License v3. See license.txt
  3. def set_print_templates_for_item_table(doc, settings):
  4. doc.print_templates = {
  5. "items": "templates/print_formats/includes/items.html",
  6. }
  7. doc.child_print_templates = {
  8. "items": {
  9. "qty": "templates/print_formats/includes/item_table_qty.html",
  10. }
  11. }
  12. if doc.meta.get_field("items"):
  13. doc.meta.get_field("items").hide_in_print_layout = ["uom", "stock_uom"]
  14. doc.flags.compact_item_fields = ["description", "qty", "rate", "amount"]
  15. if settings.compact_item_print:
  16. doc.child_print_templates["items"][
  17. "description"
  18. ] = "templates/print_formats/includes/item_table_description.html"
  19. doc.flags.format_columns = format_columns
  20. def set_print_templates_for_taxes(doc, settings):
  21. doc.flags.show_inclusive_tax_in_print = doc.is_inclusive_tax()
  22. doc.print_templates.update(
  23. {
  24. "total": "templates/print_formats/includes/total.html",
  25. "taxes": "templates/print_formats/includes/taxes.html",
  26. }
  27. )
  28. def format_columns(display_columns, compact_fields):
  29. compact_fields = compact_fields + ["image", "item_code", "item_name"]
  30. final_columns = []
  31. for column in display_columns:
  32. if column not in compact_fields:
  33. final_columns.append(column)
  34. return final_columns