Skip to content

[Settings]: Taxes — Default Tax Rate #263

Closed

Description

@nielsdrost7

SMART Plan — Set default invoice tax rate in Taxes Settings

Specific

A Select field labelled "Default Invoice Tax Rate" in the Taxes tab of the Company Settings page. Options are populated from the company's own TaxRate records. Stores the selected TaxRate ID as a string under the key default_invoice_tax_rate_id, scoped to the current company. The stored ID is applied as the default tax rate when new invoice line items are created.

Measurable

  • The field appears in the Taxes section of the Company Settings page
  • Saving the form persists the value to the settings table with key default_invoice_tax_rate_id and company_id scope
  • The value is read back correctly on page reload
  • New invoice items default to the tax rate whose ID matches the stored value

Achievable

  1. Create/extend Modules/Core/Filament/Company/Pages/CompanySettings.php (Filament page with tabs)
  2. Add a Select::make('default_invoice_tax_rate_id')->label('Default Invoice Tax Rate')->options(fn() => TaxRate::forCompany()->pluck('name', 'id')) field to the Taxes tab section
  3. Add const DEFAULT_INVOICE_TAX_RATE_ID = 'default_invoice_tax_rate_id'; to Modules/Core/Models/Setting.php constants
  4. Register the page in CompanyPanelProvider

Relevant

Most companies apply the same tax rate to the majority of their invoices. Storing a company-level default eliminates repetitive selection on each invoice item and reduces errors from choosing the wrong tax rate.

Time-bound

Sprint 6.


Arrange · Act · Assert

// Modules/Core/Tests/Feature/CompanySettingsTest.php

#[Test]
public function it_saves_default_invoice_tax_rate_id_setting(): void
{
    /* Arrange */
    $taxRate = \Modules\Core\Models\TaxRate::factory()->for($this->company)->create();

    $page = Livewire::actingAs($this->user)
        ->test(\Modules\Core\Filament\Company\Pages\CompanySettings::class);

    /* Act */
    $page->set('data.default_invoice_tax_rate_id', $taxRate->id)
         ->call('save');

    /* Assert */
    $page->assertSuccessful();
    $this->assertDatabaseHas('settings', [
        'company_id' => $this->company->id,
        'key'        => 'default_invoice_tax_rate_id',
        'value'      => (string) $taxRate->id,
    ]);
}

Activity

  1. coderabbitai commented on Dec 28, 2025

    @coderabbitai
    Contributor

    📝 CodeRabbit Plan Mode

    Generate an implementation plan and prompts that you can use with your favorite coding agent.

    • Create Plan
    Examples

    🔗 Similar Issues

    Related Issues

    👤 Suggested Assignees

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added this to the v2.0.0-alpha milestone on Dec 28, 2025
  3. changed the title [-]As an Admin in the Company Panel (Taxes tab) i want to be able to set the Default Invoice Tax Rate[/-] [+][Settings]: Taxes — Default Tax Rate[/+] on Jun 13, 2026
  4. nielsdrost7 commented on Jul 24, 2026

    @nielsdrost7
    CollaboratorAuthor

    SMART Plan — Tax settings per-company: Default invoice tax rate

    Context/Epic: Settings

    Solid plan with good test coverage. A couple of notes:

    1. Infrastructure: Modules/Core/Filament/Company/Pages/CompanySettings.php doesn't exist yet. This batch of 8 settings issues ([Settings]: Invoices — Client Portal & Public Links #259–266) will scaffold it. Group [Settings]: Taxes — Default Tax Rate #263–264 together under a single Taxes tab.

    2. Default application: Applied when new invoice items are created. You'll need an InvoiceItem factory callback or observer to read the company setting and pre-fill it — make sure it reads from the current company context.

    3. UI consistency: Keep the Select wording parallel to [Settings]: Taxes — Tax Calculation Mode #264 ("Default Invoice Tax Rate"), so both settings are visually consistent in the Taxes tab. Add helptext: "New invoice line items will default to this rate unless overridden."

    4. Null handling: Handle gracefully if the company has no TaxRates, or the stored ID is stale (deleted TaxRate). The Select query should filter to existing TaxRates only.

    Ready to implement — straightforward, pairs well with #264.

  5. nielsdrost7 commented on Jul 24, 2026

    @nielsdrost7
    CollaboratorAuthor

    Correction: an unmerged local branch, settings-cluster-2026-07-19, already implements this via a new Modules/Core/Filament/Company/Pages/CompanySettings.php page (490 lines) + CompanySettingsTest.php, covering mail send method/from-address, default invoice/quote tax rates, quote PDF template/public/email templates, quote footer, quote validity days, invoice/quote PDF password + mark-as-sent toggles, and invoice default footer. The SMART Plan comment above was posted in error by an automated grooming pass that didn't check non-issue-numbered branch names. Please check that branch before implementing this from scratch — it may just need finishing/rebasing rather than a fresh implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refinedRefined with SMART plan / test suggestions

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions