Skip to content

Commit c380907

Browse files
committed
don't copy original currency if it's the same as curency
1 parent 590e09d commit c380907

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/libs/actions/Transaction.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,9 @@ function changeTransactionsReport({
10541054

10551055
const {comment} = isUnreported ? recalculateUnreportedTransactionDetails() : {};
10561056

1057+
const shouldCopyOriginalAmount = transaction.originalAmount !== undefined && transaction.originalAmount !== transaction.amount;
1058+
const shouldCopyOriginalCurrency = transaction.originalCurrency !== undefined && transaction.originalCurrency !== transaction.currency;
1059+
10571060
// 1. Optimistically update the transaction with full data and changed fields.
10581061
// Spreading the full transaction ensures the TRANSACTION collection has complete data
10591062
// (e.g. amount) even when the existing entry was incomplete from search results.
@@ -1064,6 +1067,8 @@ function changeTransactionsReport({
10641067
...transaction,
10651068
reportID,
10661069
comment,
1070+
originalAmount: shouldCopyOriginalAmount ? transaction.originalAmount : null,
1071+
originalCurrency: shouldCopyOriginalCurrency ? transaction.originalCurrency : null,
10671072
...(shouldClearAmount && {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}),
10681073
...(shouldClearAmount && {convertedAmount: null}),
10691074
...(oldIOUAction ? {linkedTrackedExpenseReportAction: newIOUAction} : {}),

0 commit comments

Comments
 (0)