@@ -424,6 +424,7 @@ function getRate({
424424 policyForMovingExpenses,
425425 isFakeP2PRate,
426426 isMovingTransactionFromTrackExpense,
427+ personalPolicyOutputCurrency,
427428} : {
428429 transaction : OnyxEntry < Transaction > ;
429430 policy : OnyxEntry < Policy > ;
@@ -432,13 +433,14 @@ function getRate({
432433 useTransactionDistanceUnit ?: boolean ;
433434 isFakeP2PRate ?: boolean ;
434435 isMovingTransactionFromTrackExpense ?: boolean ;
436+ personalPolicyOutputCurrency ?: string ;
435437} ) : MileageRate {
436438 let mileageRates = getMileageRates ( policy , true , transaction ?. comment ?. customUnit ?. customUnitRateID ) ;
437439 if ( isEmptyObject ( mileageRates ) && policyDraft ) {
438440 mileageRates = getMileageRates ( policyDraft , true , transaction ?. comment ?. customUnit ?. customUnitRateID ) ;
439441 }
440442 const mileageRatesForMovingExpenses = getMileageRates ( policyForMovingExpenses , true , transaction ?. comment ?. customUnit ?. customUnitRateID ) ;
441- const policyCurrency = policy ?. outputCurrency ?? getPersonalPolicy ( ) ?. outputCurrency ?? CONST . CURRENCY . USD ;
443+ const policyCurrency = policy ?. outputCurrency ?? personalPolicyOutputCurrency ?? getPersonalPolicy ( ) ?. outputCurrency ?? CONST . CURRENCY . USD ;
442444 const isUnreportedExpense = isExpenseUnreported ( transaction ) ;
443445 const defaultMileageRate = getDefaultMileageRate ( policy ) ;
444446 const customUnitRateID = getRateID ( transaction ) ;
@@ -461,8 +463,18 @@ function getRate({
461463 * For example, if an expense is '10 mi @ $1.00 / mi' and the rate is updated to '$1.00 / km',
462464 * then the updated distance unit should be 'km' from the updated rate, not 'mi' from the currently stored transaction distance unit.
463465 */
464- function getUpdatedDistanceUnit ( { transaction, policy, policyDraft} : { transaction : OnyxEntry < Transaction > ; policy : OnyxEntry < Policy > ; policyDraft ?: OnyxEntry < Policy > } ) {
465- return getRate ( { transaction, policy, policyDraft, useTransactionDistanceUnit : false } ) . unit ;
466+ function getUpdatedDistanceUnit ( {
467+ transaction,
468+ policy,
469+ policyDraft,
470+ personalPolicyOutputCurrency,
471+ } : {
472+ transaction : OnyxEntry < Transaction > ;
473+ policy : OnyxEntry < Policy > ;
474+ policyDraft ?: OnyxEntry < Policy > ;
475+ personalPolicyOutputCurrency ?: string ;
476+ } ) {
477+ return getRate ( { transaction, policy, policyDraft, useTransactionDistanceUnit : false , personalPolicyOutputCurrency} ) . unit ;
466478}
467479
468480/**
0 commit comments