Skip to content

Fix dashboard outstanding amount showing wrong currency label#405

Open
Cryptoteep wants to merge 4 commits into
tuttle-dev:mainfrom
Cryptoteep:fix/dashboard-outstanding-currency-mismatch
Open

Fix dashboard outstanding amount showing wrong currency label#405
Cryptoteep wants to merge 4 commits into
tuttle-dev:mainfrom
Cryptoteep:fix/dashboard-outstanding-currency-mismatch

Conversation

@Cryptoteep

Copy link
Copy Markdown

Summary

Fixes #400.

The dashboard's Outstanding and Overdue KPI cards always formatted their totals using the tax system's currency (e.g. EUR for a freelancer operating in Germany), regardless of the currency each invoice was actually issued in. As reported in the issue, an unpaid invoice issued in USD was displayed on the dashboard labeled as EUR — and outstanding amounts in different currencies were being summed together under a single, potentially wrong, currency symbol.

Fix

  • compute_kpis (in tuttle/kpi.py) now tracks unpaid/overdue totals per invoice currency (KPISummary.outstanding_by_currency / overdue_by_currency), using the same currency resolution already used elsewhere for invoices (invoice.contract.currency, falling back to "EUR").
  • KPISummary.to_rpc_dict() now formats outstanding_amount_formatted / overdue_amount_formatted using the invoice's real currency when only one currency is present. When invoices use multiple currencies, each currency's amount is formatted and shown separately instead of being summed under one (possibly incorrect) label.
  • No currency conversion is introduced — this only fixes the currency label mismatch. Amounts in different currencies are never mixed together.

Test plan

  • Added TestComputeKPIs.test_outstanding_currency_matches_invoice_currency, test_outstanding_amounts_in_different_currencies_not_mixed, and test_overdue_currency_matches_invoice_currency in tuttle_tests/test_dashboard.py, covering: a USD-only invoice labeled $, mixed EUR+USD invoices not silently summed, and overdue amounts following the same logic.
  • Added TestFormatAmountByCurrency unit tests for the new _format_amount_by_currency helper.
  • Full existing test suite passes (uv run pytest tuttle_tests/) except one pre-existing, unrelated failure (test_rendering.py::TestRenderTimesheet::test_creates_only_final_file), confirmed to fail identically on main before this change.

Cryptoteep and others added 3 commits July 10, 2026 10:53
The dashboard's Outstanding and Overdue KPI cards always formatted
totals using the tax system's currency (EUR for Germany), regardless
of the currency an invoice was actually issued in. An unpaid USD
invoice was therefore shown with a EUR label, silently mixing
currencies whenever invoices used more than one.

compute_kpis now tracks outstanding/overdue totals per invoice
currency (KPISummary.outstanding_by_currency / overdue_by_currency).
to_rpc_dict formats using the invoice's real currency when only one
is present, and shows each amount separately (joined) when multiple
currencies are outstanding, instead of summing them under one wrong
label.

Fixes tuttle-dev#400
@aaronspring

Copy link
Copy Markdown
Contributor

No currency conversion is introduced — this only fixes the currency label mismatch.

this is the clean fix for #400. Clean as of a user bills and taxes in the same currency. Which is different to my personal case where I bill in one currency but pay taxes in another, see mixed currency #401

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

currency in dashboard, tax and salary

3 participants