From 653117c2a93d9fca2a9f421a8adba21f261f6e64 Mon Sep 17 00:00:00 2001 From: DaizyModi Date: Fri, 21 Jul 2023 17:52:54 +0530 Subject: [PATCH] test: fix test case for itemised tax breakup --- .../sales_invoice/test_sales_invoice.py | 22 ++++++++++++------- erpnext/controllers/taxes_and_totals.py | 4 ++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 0280c3590c..41e55546a8 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -1900,16 +1900,22 @@ class TestSalesInvoice(unittest.TestCase): si = self.create_si_to_test_tax_breakup() - itemised_tax, itemised_taxable_amount = get_itemised_tax_breakup_data(si) + itemised_tax_data = get_itemised_tax_breakup_data(si) - expected_itemised_tax = { - "_Test Item": {"Service Tax": {"tax_rate": 10.0, "tax_amount": 1000.0}}, - "_Test Item 2": {"Service Tax": {"tax_rate": 10.0, "tax_amount": 500.0}}, - } - expected_itemised_taxable_amount = {"_Test Item": 10000.0, "_Test Item 2": 5000.0} + expected_itemised_tax = [ + { + "item": "_Test Item", + "taxable_amount": 10000.0, + "Service Tax": {"tax_rate": 10.0, "tax_amount": 1000.0}, + }, + { + "item": "_Test Item 2", + "taxable_amount": 5000.0, + "Service Tax": {"tax_rate": 10.0, "tax_amount": 500.0}, + }, + ] - self.assertEqual(itemised_tax, expected_itemised_tax) - self.assertEqual(itemised_taxable_amount, expected_itemised_taxable_amount) + self.assertEqual(itemised_tax_data, expected_itemised_tax) frappe.flags.country = None diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index d9b8acb8ed..04d5e1c69a 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -999,8 +999,8 @@ def get_itemised_tax_breakup_header(item_doctype, tax_accounts): @erpnext.allow_regional -def get_itemised_tax_breakup_data(doc, with_tax_account=False): - return _get_itemised_tax_breakup_data(doc, with_tax_account=False) +def get_itemised_tax_breakup_data(doc): + return _get_itemised_tax_breakup_data(doc) def _get_itemised_tax_breakup_data(doc, with_tax_account=False):