mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-12 19:35:09 +00:00
refactor(test): use JSON for company master
This commit is contained in:
@@ -106,11 +106,12 @@ class TestCompany(ERPNextTestSuite):
|
||||
)
|
||||
|
||||
def test_basic_tree(self, records=None):
|
||||
self.load_test_records("Company")
|
||||
min_lft = 1
|
||||
max_rgt = frappe.db.sql("select max(rgt) from `tabCompany`")[0][0]
|
||||
|
||||
if not records:
|
||||
records = self.companies[2:]
|
||||
records = self.globalTestRecords["Company"][2:]
|
||||
|
||||
for company in records:
|
||||
lft, rgt, parent_company = frappe.db.get_value(
|
||||
|
||||
184
erpnext/setup/doctype/company/test_records.json
Normal file
184
erpnext/setup/doctype/company/test_records.json
Normal file
@@ -0,0 +1,184 @@
|
||||
[
|
||||
{
|
||||
"abbr": "_TC",
|
||||
"company_name": "_Test Company",
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
"allow_account_creation_against_child_company": 1
|
||||
},
|
||||
{
|
||||
"abbr": "_TC1",
|
||||
"company_name": "_Test Company 1",
|
||||
"country": "United States",
|
||||
"default_currency": "USD",
|
||||
"doctype": "Company",
|
||||
"domain": "Retail",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0
|
||||
},
|
||||
{
|
||||
"abbr": "_TC2",
|
||||
"company_name": "_Test Company 2",
|
||||
"default_currency": "EUR",
|
||||
"country": "Germany",
|
||||
"doctype": "Company",
|
||||
"domain": "Retail",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0
|
||||
},
|
||||
{
|
||||
"abbr": "_TC3",
|
||||
"company_name": "_Test Company 3",
|
||||
"is_group": 1,
|
||||
"country": "Pakistan",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0
|
||||
},
|
||||
{
|
||||
"abbr": "_TC4",
|
||||
"company_name": "_Test Company 4",
|
||||
"parent_company": "_Test Company 3",
|
||||
"is_group": 1,
|
||||
"country": "Pakistan",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0
|
||||
},
|
||||
{
|
||||
"abbr": "_TC5",
|
||||
"company_name": "_Test Company 5",
|
||||
"parent_company": "_Test Company 4",
|
||||
"country": "Pakistan",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0
|
||||
},
|
||||
{
|
||||
"abbr": "TCP1",
|
||||
"company_name": "_Test Company with perpetual inventory",
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 1
|
||||
},
|
||||
{
|
||||
"abbr": "_TC6",
|
||||
"company_name": "_Test Company 6",
|
||||
"is_group": 1,
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0
|
||||
},
|
||||
{
|
||||
"abbr": "_TC7",
|
||||
"company_name": "_Test Company 7",
|
||||
"parent_company": "_Test Company 6",
|
||||
"is_group": 1,
|
||||
"country": "United States",
|
||||
"default_currency": "USD",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0
|
||||
},
|
||||
{
|
||||
"doctype": "Company",
|
||||
"default_currency": "USD",
|
||||
"full_name": "Test User",
|
||||
"company_name": "Wind Power LLC",
|
||||
"timezone": "America/New_York",
|
||||
"abbr": "WP",
|
||||
"industry": "Manufacturing",
|
||||
"country": "United States",
|
||||
"language": "english",
|
||||
"company_tagline": "Testing",
|
||||
"email": "test@erpnext.com",
|
||||
"password": "test",
|
||||
"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": "_Test Holiday List",
|
||||
"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": "_Test Holiday List",
|
||||
"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": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
"parent_company": "Parent Group Company India"
|
||||
},
|
||||
{
|
||||
"abbr": "BT",
|
||||
"company_name": "Best Test",
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"chart_of_accounts": "Standard"
|
||||
},
|
||||
{
|
||||
"abbr": "_TCUV",
|
||||
"company_name": "_Test Company UAE VAT",
|
||||
"country": "United Arab Emirates",
|
||||
"default_currency": "AED",
|
||||
"doctype": "Company",
|
||||
"create_chart_of_accounts_based_on": "Standard Template"
|
||||
},
|
||||
{
|
||||
"abbr": "_TCSV",
|
||||
"company_name": "_Test Company SA VAT",
|
||||
"country": "South Africa",
|
||||
"default_currency": "ZAR",
|
||||
"doctype": "Company",
|
||||
"create_chart_of_accounts_based_on": "Standard Template"
|
||||
}
|
||||
]
|
||||
@@ -699,190 +699,7 @@ class BootStrapTestData:
|
||||
self.make_records(["holiday_list_name"], records, "holiday_list")
|
||||
|
||||
def make_company(self):
|
||||
records = [
|
||||
{
|
||||
"abbr": "_TC",
|
||||
"company_name": "_Test Company",
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
"allow_account_creation_against_child_company": 1,
|
||||
},
|
||||
{
|
||||
"abbr": "_TC1",
|
||||
"company_name": "_Test Company 1",
|
||||
"country": "United States",
|
||||
"default_currency": "USD",
|
||||
"doctype": "Company",
|
||||
"domain": "Retail",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
},
|
||||
{
|
||||
"abbr": "_TC2",
|
||||
"company_name": "_Test Company 2",
|
||||
"default_currency": "EUR",
|
||||
"country": "Germany",
|
||||
"doctype": "Company",
|
||||
"domain": "Retail",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
},
|
||||
{
|
||||
"abbr": "_TC3",
|
||||
"company_name": "_Test Company 3",
|
||||
"is_group": 1,
|
||||
"country": "Pakistan",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
},
|
||||
{
|
||||
"abbr": "_TC4",
|
||||
"company_name": "_Test Company 4",
|
||||
"parent_company": "_Test Company 3",
|
||||
"is_group": 1,
|
||||
"country": "Pakistan",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
},
|
||||
{
|
||||
"abbr": "_TC5",
|
||||
"company_name": "_Test Company 5",
|
||||
"parent_company": "_Test Company 4",
|
||||
"country": "Pakistan",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
},
|
||||
{
|
||||
"abbr": "TCP1",
|
||||
"company_name": "_Test Company with perpetual inventory",
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"enable_perpetual_inventory": 1,
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
},
|
||||
{
|
||||
"abbr": "_TC6",
|
||||
"company_name": "_Test Company 6",
|
||||
"is_group": 1,
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
},
|
||||
{
|
||||
"abbr": "_TC7",
|
||||
"company_name": "_Test Company 7",
|
||||
"parent_company": "_Test Company 6",
|
||||
"is_group": 1,
|
||||
"country": "United States",
|
||||
"default_currency": "USD",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"chart_of_accounts": "Standard",
|
||||
"default_holiday_list": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
},
|
||||
{
|
||||
"doctype": "Company",
|
||||
"default_currency": "USD",
|
||||
"full_name": "Test User",
|
||||
"company_name": "Wind Power LLC",
|
||||
"timezone": "America/New_York",
|
||||
"abbr": "WP",
|
||||
"industry": "Manufacturing",
|
||||
"country": "United States",
|
||||
"language": "english",
|
||||
"company_tagline": "Testing",
|
||||
"email": "test@erpnext.com",
|
||||
"password": "test",
|
||||
"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": "_Test Holiday List",
|
||||
"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": "_Test Holiday List",
|
||||
"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": "_Test Holiday List",
|
||||
"enable_perpetual_inventory": 0,
|
||||
"parent_company": "Parent Group Company India",
|
||||
},
|
||||
{
|
||||
"abbr": "BT",
|
||||
"company_name": "Best Test",
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"chart_of_accounts": "Standard",
|
||||
},
|
||||
{
|
||||
"abbr": "_TCUV",
|
||||
"company_name": "_Test Company UAE VAT",
|
||||
"country": "United Arab Emirates",
|
||||
"default_currency": "AED",
|
||||
"doctype": "Company",
|
||||
"create_chart_of_accounts_based_on": "Standard Template",
|
||||
},
|
||||
{
|
||||
"abbr": "_TCSV",
|
||||
"company_name": "_Test Company SA VAT",
|
||||
"country": "South Africa",
|
||||
"default_currency": "ZAR",
|
||||
"doctype": "Company",
|
||||
"create_chart_of_accounts_based_on": "Standard Template",
|
||||
},
|
||||
]
|
||||
records = load_test_records_for("Company")["Company"]
|
||||
self.make_records(["company_name"], records, "companies")
|
||||
|
||||
def make_fiscal_year(self):
|
||||
|
||||
Reference in New Issue
Block a user