mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-07 12:10:04 -06:00
Fixed issue where invoices were always displaying EUR as the currency regardless of what was configured in Settings. The Invoice model had a hard-coded default of 'EUR' and the invoice creation route wasn't explicitly setting the currency from Settings. Changes: - Updated invoice creation route to fetch and use currency from Settings - Updated invoice duplication to preserve original invoice's currency - Added currency code display to all monetary values in invoice templates - Added currency code display to invoice list totals - Created migration script to update existing invoices - Added comprehensive unit tests and smoke tests - Added detailed documentation for the fix Backend changes: - app/routes/invoices.py: Retrieve currency from Settings when creating invoices, pass currency_code explicitly to Invoice constructor - app/routes/invoices.py: Preserve currency_code when duplicating invoices Frontend changes: - app/templates/invoices/view.html: Display currency code next to all monetary values (items, extra goods, subtotals, tax, totals) - app/templates/invoices/list.html: Display currency code next to invoice totals in list view Testing: - tests/test_invoice_currency_fix.py: 10 unit tests covering various currency scenarios and edge cases - tests/test_invoice_currency_smoke.py: 2 end-to-end smoke tests Migration: - migrations/fix_invoice_currency.py: Script to update existing invoices to use the currency from Settings This fix is fully backward compatible. Existing invoices will continue to work with their current currency values. Run the migration script to update existing invoices to match the Settings currency. Resolves: #153 (invoices-display-currency-as-eur-and-not-usd)