Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,18 @@ function MoneyRequestConfirmationList({
const taxPercentage =
getTaxValue(policy, transaction, transaction?.taxCode ?? defaultTaxCode) ??
(isMovingTransactionFromTrackExpense ? getTaxValue(policyForMovingExpenses, transaction, transaction?.taxCode ?? defaultTaxCode) : '');
const taxAmount = calculateTaxAmount(taxPercentage, taxableAmount, transaction?.currency ?? CONST.CURRENCY.USD);
const taxAmount =
isMovingTransactionFromTrackExpense && transaction?.taxAmount
? Math.abs(transaction?.taxAmount ?? 0)
Comment on lines +541 to +543

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve zero tax amounts when moving track expense

This check only preserves the stored tax amount when it’s truthy, but a tax amount of 0 is explicitly valid (MoneyRequestAmountForm.tsx around lines 168–172 skips validation for zero on the tax amount form). If a tracked expense has a manual 0 tax with a non‑zero tax rate, it will fall through to calculateTaxAmount and be overwritten with a positive amount when moving the expense. That reintroduces the recalculation the change is trying to avoid; consider checking for null/undefined instead of truthiness so zero is preserved.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| If a tracked expense has a manual 0 tax with a non‑zero tax rate, it will fall through to calculateTaxAmount and be overwritten with a positive amount when moving the expense
Screenshot 2026-01-22 at 14 04 46

checked it - it doesn't happen

: calculateTaxAmount(taxPercentage, taxableAmount, transaction?.currency ?? CONST.CURRENCY.USD);

const taxAmountInSmallestCurrencyUnits = convertToBackendAmount(Number.parseFloat(taxAmount.toString()));
useEffect(() => {
if (!transactionID || isReadOnly || !shouldShowTax) {
if (!transactionID || isReadOnly || !shouldShowTax || isMovingTransactionFromTrackExpense) {
return;
}
setMoneyRequestTaxAmount(transactionID, taxAmountInSmallestCurrencyUnits);
}, [transactionID, taxAmountInSmallestCurrencyUnits, isReadOnly, shouldShowTax]);
}, [transactionID, taxAmountInSmallestCurrencyUnits, isReadOnly, shouldShowTax, isMovingTransactionFromTrackExpense]);

// If completing a split expense fails, set didConfirm to false to allow the user to edit the fields again
if (isEditingSplitBill && didConfirm) {
Expand Down
6 changes: 4 additions & 2 deletions src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6669,7 +6669,9 @@ function trackExpense(params: CreateTrackExpenseParams) {
value: recentServerValidatedWaypoints,
});

if (isMapDistanceRequest(transaction) || isManualDistanceRequestTransactionUtils(transaction) || isOdometerDistanceRequestTransactionUtils(transaction)) {
const isDistanceRequest = isMapDistanceRequest(transaction) || isManualDistanceRequestTransactionUtils(transaction) || isOdometerDistanceRequestTransactionUtils(transaction);

if (isDistanceRequest) {
// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830
onyxData?.optimisticData?.push({
onyxMethod: Onyx.METHOD.SET,
Expand Down Expand Up @@ -6804,7 +6806,7 @@ function trackExpense(params: CreateTrackExpenseParams) {
reportPreviewReportActionID: reportPreviewAction?.reportActionID,
optimisticReportID,
optimisticReportActionID,
policyID: policy?.id,
policyID: isDistanceRequest ? undefined : policy?.id,
receipt: isFileUploadable(trackedReceipt) ? trackedReceipt : undefined,
receiptState: trackedReceipt?.state,
reimbursable,
Expand Down