mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
refactor(test): make consolidated trial balance report deterministic
This commit is contained in:
@@ -15,24 +15,9 @@ class ForeignCurrencyTranslationReserveNotFoundError(frappe.ValidationError):
|
|||||||
|
|
||||||
|
|
||||||
class TestConsolidatedTrialBalance(ERPNextTestSuite):
|
class TestConsolidatedTrialBalance(ERPNextTestSuite):
|
||||||
@classmethod
|
def setUp(self):
|
||||||
def setUpClass(cls):
|
|
||||||
from erpnext.accounts.report.trial_balance.test_trial_balance import create_company
|
|
||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import get_fiscal_year
|
||||||
|
|
||||||
# Group Company
|
|
||||||
create_company(company_name="Parent Group Company India", is_group=1)
|
|
||||||
|
|
||||||
create_company(company_name="Child Company India", parent_company="Parent Group Company India")
|
|
||||||
|
|
||||||
# Child Company with different currency
|
|
||||||
create_company(
|
|
||||||
company_name="Child Company US",
|
|
||||||
country="United States",
|
|
||||||
currency="USD",
|
|
||||||
parent_company="Parent Group Company India",
|
|
||||||
)
|
|
||||||
|
|
||||||
create_journal_entry(
|
create_journal_entry(
|
||||||
company="Parent Group Company India",
|
company="Parent Group Company India",
|
||||||
acc1="Marketing Expenses - PGCI",
|
acc1="Marketing Expenses - PGCI",
|
||||||
@@ -48,7 +33,7 @@ class TestConsolidatedTrialBalance(ERPNextTestSuite):
|
|||||||
company="Child Company US", acc1="Marketing Expenses - CCU", acc2="Cash - CCU", amount=1000
|
company="Child Company US", acc1="Marketing Expenses - CCU", acc2="Cash - CCU", amount=1000
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.fiscal_year = get_fiscal_year(today(), company="Parent Group Company India")[0]
|
self.fiscal_year = get_fiscal_year(today(), company="Parent Group Company India")[0]
|
||||||
|
|
||||||
def test_single_company_report(self):
|
def test_single_company_report(self):
|
||||||
filters = frappe._dict({"company": ["Parent Group Company India"], "fiscal_year": self.fiscal_year})
|
filters = frappe._dict({"company": ["Parent Group Company India"], "fiscal_year": self.fiscal_year})
|
||||||
|
|||||||
@@ -936,6 +936,42 @@ class ERPNextTestSuite(unittest.TestCase):
|
|||||||
"password": "test",
|
"password": "test",
|
||||||
"chart_of_accounts": "Standard",
|
"chart_of_accounts": "Standard",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"abbr": "PGCI",
|
||||||
|
"company_name": "Parent Group Company India",
|
||||||
|
"country": "India",
|
||||||
|
"default_currency": "INR",
|
||||||
|
"doctype": "Company",
|
||||||
|
"domain": "Manufacturing",
|
||||||
|
"chart_of_accounts": "Standard",
|
||||||
|
"default_holiday_list": cls.holiday_list[0].name,
|
||||||
|
"enable_perpetual_inventory": 0,
|
||||||
|
"is_group": 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"abbr": "CCI",
|
||||||
|
"company_name": "Child Company India",
|
||||||
|
"country": "India",
|
||||||
|
"default_currency": "INR",
|
||||||
|
"doctype": "Company",
|
||||||
|
"domain": "Manufacturing",
|
||||||
|
"chart_of_accounts": "Standard",
|
||||||
|
"default_holiday_list": cls.holiday_list[0].name,
|
||||||
|
"enable_perpetual_inventory": 0,
|
||||||
|
"parent_company": "Parent Group Company India",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"abbr": "CCU",
|
||||||
|
"company_name": "Child Company US",
|
||||||
|
"country": "United States",
|
||||||
|
"default_currency": "USD",
|
||||||
|
"doctype": "Company",
|
||||||
|
"domain": "Manufacturing",
|
||||||
|
"chart_of_accounts": "Standard",
|
||||||
|
"default_holiday_list": cls.holiday_list[0].name,
|
||||||
|
"enable_perpetual_inventory": 0,
|
||||||
|
"parent_company": "Parent Group Company India",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
cls.companies = []
|
cls.companies = []
|
||||||
for x in records:
|
for x in records:
|
||||||
|
|||||||
Reference in New Issue
Block a user