#1580·aureuserp

Setup returns true with an incomplete template, leaving the company broken

Author: fmoedCreated Sep 24, 2026Updated Sep 25, 2026
Labelsbug

Description

Follow-up to #1573.

While testing the fix for #1573, I found a separate reproducible issue in AccountingSetupService::setUp().

The service can return true when the selected template company is incomplete. It copies the data available in the template, such as journals and taxes, but does not verify that the required accounting settings stored under accounts_accounts are present.

After that, isSetUp() considers the target company configured because Sale and Purchase journals exist, even though other required accounting settings are still missing. The setup action then disappears, and affected pages fail with MissingSettings.

This is separate from #1573: #1573 covers the false success notification when setUp() returns false, while this issue covers setup being reported as successful with an incomplete template.

Steps to Reproduce

  1. Prepare a template company with Sale and Purchase journals but no required accounts_accounts settings rows.
  2. Create a fresh target company with the incomplete company set as the setup template (default company).
  3. Run Setup Accounting.
  4. Open manage-default-accounts or the product creation page.

❌ Actual Behavior

  • AccountingSetupService::setUp() returns true.
  • Available data is copied from the incomplete template.
  • Required accounting settings stored under accounts_accounts remain missing.
  • isSetUp() considers the target company configured because Sale and Purchase journals exist, even though other required accounting settings are missing.
  • The setup action is no longer available.
  • The affected pages fail with MissingSettings.

✅ Expected Behavior

  • The template should be validated before setup data is copied.
  • An incomplete template should cause setup to fail instead of reporting success.
  • Template validation should occur before copying any setup data.
  • A company with required accounting settings still missing should not be considered fully set up, so setup can be retried.

Root Cause

  • setUp() does not validate the completeness of the template before copying data.
  • isSetUp() currently treats the presence of Sale and Purchase journals as sufficient evidence that accounting setup is complete.

✅ Acceptance Criteria

  • An incomplete template does not result in a successful setup.
  • No partial provisioning remains when template validation fails.
  • A company with missing required accounting settings is not considered fully set up.
  • A complete template continues to provision successfully.
  • Tests cover complete templates, incomplete templates, and partially configured target companies.

Out of Scope

  • Automatic provisioning of missing accounting settings.
  • Seeder redesign or changes to installation data.
  • Silent fallback to another company as the template.
  • General handling of downstream MissingSettings errors.