Fix exchange rate parity across all document types

- Fix exchange-rate service types to match actual backend response shapes
  (exchangeRate array, activeProvider success/error, used currencies as strings)
- Add ExchangeRateConverter to payments, expenses, and recurring invoices
- Set currency_id from customer currency in invoice/estimate selectCustomer()
- Load globalStore.currencies in ExchangeRateConverter on mount
- Pass driver/key/driver_config params to getSupportedCurrencies in provider modal
- Fix OpenExchangeRateDriver validateConnection to use base=USD (free plan compat)
- Fix checkActiveCurrencies SQLite whereJsonContains with array values
- Remove broken currency/companyCurrency props from ExpenseCreateView, use stores
- Show base currency equivalent in document line items and totals when exchange
  rate is active
This commit is contained in:
Darko Gjorgjijoski
2026-04-06 21:07:50 +02:00
parent e64529468c
commit b0b7d40c73
12 changed files with 213 additions and 54 deletions

View File

@@ -128,6 +128,15 @@
:amount="total"
:currency="selectedCurrency"
/>
<span
v-if="showBaseCurrencyEquivalent"
class="block text-xs text-muted mt-1"
>
<BaseFormatMoney
:amount="baseCurrencyTotal"
:currency="companyCurrency"
/>
</span>
</span>
<div class="flex items-center justify-center w-6 h-10 mx-2">
<BaseIcon
@@ -184,6 +193,7 @@ import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { required, between, maxLength, helpers, minValue } from '@vuelidate/validators'
import useVuelidate from '@vuelidate/core'
import { useCompanyStore } from '../../../stores/company.store'
import DocumentItemRowTax from './DocumentItemRowTax.vue'
import DragIcon from '@v2/components/icons/DragIcon.vue'
import { generateClientId } from '../../../utils'
@@ -221,6 +231,7 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits<Emits>()
const { t } = useI18n()
const companyStore = useCompanyStore()
const formData = computed<DocumentFormData>(() => {
return props.store[props.storeProp] as DocumentFormData
@@ -285,6 +296,17 @@ const totalSimpleTax = computed<number>(() => {
const totalTax = computed<number>(() => totalSimpleTax.value)
const companyCurrency = computed(() => companyStore.selectedCompanyCurrency)
const showBaseCurrencyEquivalent = computed<boolean>(() => {
return !!(formData.value.exchange_rate && (props.store as Record<string, unknown>).showExchangeRate)
})
const baseCurrencyTotal = computed<number>(() => {
if (!formData.value.exchange_rate) return 0
return Math.round(total.value * Number(formData.value.exchange_rate))
})
const rules = {
name: {
required: helpers.withMessage(t('validation.required'), required),