From abee8ac4c83693b38da59e07a698e94862ab0ce3 Mon Sep 17 00:00:00 2001 From: Casey Date: Mon, 9 Feb 2026 13:34:35 -0600 Subject: [PATCH] update install for companies --- custom_ui/install.py | 120 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/custom_ui/install.py b/custom_ui/install.py index 7cf2305..077918b 100644 --- a/custom_ui/install.py +++ b/custom_ui/install.py @@ -45,6 +45,7 @@ def after_migrate(): # create_tasks() create_bid_meeting_note_form_templates() create_accounts() + create_companies() # init_stripe_accounts() # update_address_fields() @@ -1568,6 +1569,125 @@ def create_bid_meeting_note_form_templates(): doc.insert(ignore_permissions=True) +def create_companies(): + """Create necessary companies if they do not exist.""" + print("\n🔧 Checking for necessary companies...") + + companies = [ + { + 'company_name': 'Veritas Stone', + 'abbr': 'VS', + 'default_currency': 'USD', + 'country': 'United States', + 'is_group': 0, + 'parent_company': None, + 'create_chart_of_accounts_based_on': 'Standard Template', + 'chart_of_accounts': 'Standard', + 'default_cash_account': 'Cash - VS', + 'default_receivable_account': 'Debtors - VS', + 'default_payable_account': 'Creditors - VS', + 'default_income_account': 'Sales - VS', + 'default_expense_account': 'Cost of Goods Sold - VS', + 'cost_center': 'Main - VS', + 'enable_perpetual_inventory': 1 + }, + { + 'company_name': 'Daniels Landscape Supplies', + 'abbr': 'DL', + 'default_currency': 'USD', + 'country': 'United States', + 'is_group': 0, + 'parent_company': None, + 'create_chart_of_accounts_based_on': 'Standard Template', + 'chart_of_accounts': 'Standard', + 'default_cash_account': 'Cash - DL', + 'default_receivable_account': 'Debtors - DL', + 'default_payable_account': 'Creditors - DL', + 'default_income_account': 'Sales - DL', + 'default_expense_account': 'Cost of Goods Sold - DL', + 'cost_center': 'Main - DL', + 'enable_perpetual_inventory': 1 + }, + { + 'company_name': 'sprinklersnorthwest (Demo)', + 'abbr': 'SD', + 'default_currency': 'USD', + 'country': 'United States', + 'is_group': 0, + 'parent_company': None, + 'create_chart_of_accounts_based_on': 'Standard Template', + 'chart_of_accounts': 'Standard', + 'default_cash_account': 'Cash - SD', + 'default_receivable_account': 'Debtors - SD', + 'default_payable_account': 'Creditors - SD', + 'default_income_account': 'Sales - SD', + 'default_expense_account': 'Cost of Goods Sold - SD', + 'cost_center': 'Main - SD', + 'enable_perpetual_inventory': 1 + }, + { + 'company_name': 'Lowe Fencing', + 'abbr': 'LF', + 'default_currency': 'USD', + 'country': 'United States', + 'is_group': 0, + 'parent_company': None, + 'create_chart_of_accounts_based_on': 'Standard Template', + 'chart_of_accounts': 'Standard', + 'default_cash_account': 'Cash - LF', + 'default_receivable_account': 'Debtors - LF', + 'default_payable_account': 'Creditors - LF', + 'default_income_account': 'Fencing Sales - LF', + 'default_expense_account': 'Cost of Goods Sold - LF', + 'cost_center': 'Main - LF', + 'enable_perpetual_inventory': 1 + }, + { + 'company_name': 'Nuco Yard Care', + 'abbr': 'NYC', + 'default_currency': 'USD', + 'country': 'United States', + 'is_group': 0, + 'parent_company': None, + 'create_chart_of_accounts_based_on': 'Standard Template', + 'chart_of_accounts': 'Standard', + 'default_cash_account': 'Cash - NYC', + 'default_receivable_account': 'Debtors - NYC', + 'default_payable_account': 'Creditors - NYC', + 'default_income_account': 'Sales - NYC', + 'default_expense_account': 'Cost of Goods Sold - NYC', + 'cost_center': 'Main - NYC', + 'enable_perpetual_inventory': 1 + }, + { + 'company_name': 'Sprinklers Northwest', + 'abbr': 'S', + 'default_currency': 'USD', + 'country': 'United States', + 'is_group': 0, + 'parent_company': None, + 'create_chart_of_accounts_based_on': 'Standard Template', + 'chart_of_accounts': 'Standard', + 'default_cash_account': 'Undeposited Funds - S', + 'default_receivable_account': 'Debtors - S', + 'default_payable_account': 'Creditors - S', + 'default_income_account': 'Sales - S', + 'default_expense_account': 'Cost of Goods Sold - S', + 'cost_center': 'Main - S', + 'enable_perpetual_inventory': 1 + } + ] + for company in companies: + if frappe.db.exists("Company", company["company_name"]): + continue + data = { + "doctype": "Company" + } + data.update(company) + doc = frappe.get_doc(data) + doc.insert(ignore_permissions=True) + + def create_accounts(): """Create necessary accounts if they do not exist.""" print("\n🔧 Checking for necessary accounts...")