Skip to content

Commit

Permalink
fix: make showing taxes as table in print configurable (#35672)
Browse files Browse the repository at this point in the history
(cherry picked from commit 491a50a)

# Conflicts:
#	erpnext/accounts/doctype/accounts_settings/accounts_settings.json
  • Loading branch information
anandbaburajan authored and mergify[bot] committed Jun 13, 2023
1 parent dffa682 commit b0f91b2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions erpnext/accounts/doctype/accounts_settings/accounts_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"book_tax_discount_loss",
"print_settings",
"show_inclusive_tax_in_print",
"show_taxes_as_table_in_print",
"column_break_12",
"show_payment_schedule_in_print",
"currency_exchange_section",
Expand Down Expand Up @@ -378,14 +379,24 @@
"fieldname": "auto_reconcile_payments",
"fieldtype": "Check",
"label": "Auto Reconcile Payments"
},
{
"default": "0",
"fieldname": "show_taxes_as_table_in_print",
"fieldtype": "Check",
"label": "Show Taxes as Table in Print"
}
],
"icon": "icon-cog",
"idx": 1,
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
<<<<<<< HEAD
"modified": "2023-04-21 13:11:37.130743",
=======
"modified": "2023-06-13 18:47:46.430291",
>>>>>>> 491a50a027 (fix: make showing taxes as table in print configurable (#35672))
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",
Expand Down
3 changes: 3 additions & 0 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,9 @@ def is_inclusive_tax(self):

return is_inclusive

def should_show_taxes_as_table_in_print(self):
return cint(frappe.db.get_single_value("Accounts Settings", "show_taxes_as_table_in_print"))

def validate_advance_entries(self):
order_field = "sales_order" if self.doctype == "Sales Invoice" else "purchase_order"
order_list = list(set(d.get(order_field) for d in self.get("items") if d.get(order_field)))
Expand Down
8 changes: 7 additions & 1 deletion erpnext/controllers/print_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ def set_print_templates_for_taxes(doc, settings):
doc.print_templates.update(
{
"total": "templates/print_formats/includes/total.html",
"taxes": "templates/print_formats/includes/taxes.html",
}
)

if not doc.should_show_taxes_as_table_in_print():
doc.print_templates.update(
{
"taxes": "templates/print_formats/includes/taxes.html",
}
)


def format_columns(display_columns, compact_fields):
compact_fields = compact_fields + ["image", "item_code", "item_name"]
Expand Down

0 comments on commit b0f91b2

Please sign in to comment.