From df4fc6b18657bd79158f1df31d67467244052282 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sun, 5 Jul 2026 12:44:31 +0530 Subject: [PATCH] test: use a unique company abbreviation to fix COA-template flake --- erpnext/setup/doctype/company/test_company.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py index 64f4974ef1f..7ec5bee5d0e 100644 --- a/erpnext/setup/doctype/company/test_company.py +++ b/erpnext/setup/doctype/company/test_company.py @@ -68,7 +68,12 @@ class TestCompany(ERPNextTestSuite): try: company = frappe.new_doc("Company") company.company_name = template - company.abbr = random_string(3) + # a short random abbr collides with existing test companies often enough + # to flake, so pick one that is verified unique + abbr = random_string(3) + while frappe.db.exists("Company", {"abbr": abbr}): + abbr = random_string(3) + company.abbr = abbr company.default_currency = "USD" company.create_chart_of_accounts_based_on = "Standard Template" company.chart_of_accounts = template