From 68a31d3d0d799608fbf5593f5f7d732d2971eb03 Mon Sep 17 00:00:00 2001 From: casesolved-co-uk Date: Sat, 10 Apr 2021 18:59:57 +0000 Subject: [PATCH] fix: fiscal year error --- .../report/tax_detail/test_tax_detail.py | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/erpnext/accounts/report/tax_detail/test_tax_detail.py b/erpnext/accounts/report/tax_detail/test_tax_detail.py index dcf0e790641..772b9a468ae 100644 --- a/erpnext/accounts/report/tax_detail/test_tax_detail.py +++ b/erpnext/accounts/report/tax_detail/test_tax_detail.py @@ -18,6 +18,23 @@ class TestTaxDetail(unittest.TestCase): self.from_date = get_first_day(now) self.to_date = get_last_day(now) + for fy in frappe.get_list('Fiscal Year', fields=('year', 'year_start_date', 'year_end_date')): + if now >= fy['year_start_date'] and now <= fy['year_end_date']: + break + else: + docs = [{ + "companies": [{ + "company": "_T", + "parent": "_Test Fiscal", + "parentfield": "companies", + "parenttype": "Fiscal Year" + }], + "doctype": "Fiscal Year", + "year": "_Test Fiscal", + "year_end_date": get_year_ending(now), + "year_start_date": get_year_start(now) + }] + docs + docs = [{ "abbr": "_T", "company_name": "_T", @@ -25,17 +42,6 @@ class TestTaxDetail(unittest.TestCase): "default_currency": "GBP", "doctype": "Company", "name": "_T" - },{ - "companies": [{ - "company": "_T", - "parent": "_Test Fiscal", - "parentfield": "companies", - "parenttype": "Fiscal Year" - }], - "doctype": "Fiscal Year", - "year": "_Test Fiscal", - "year_end_date": get_year_ending(now), - "year_start_date": get_year_start(now) }] + docs for doc in docs: