From af223ad6705563325b36573b8228fb2e23dfe1c2 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Mon, 13 May 2024 17:54:27 +0530 Subject: [PATCH 1/2] Add tax code system message for direct tax code change --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index be4d230b6843..4511b932458a 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2983,7 +2983,7 @@ function getModifiedExpenseOriginalMessage( originalMessage.tag = transactionChanges?.tag; } - if ('taxAmount' in transactionChanges) { + if ('taxAmount' in transactionChanges && !('amount' in transactionChanges || 'currency' in transactionChanges || 'taxCode' in transactionChanges)) { originalMessage.oldTaxAmount = TransactionUtils.getTaxAmount(oldTransaction, isFromExpenseReport); originalMessage.taxAmount = transactionChanges?.taxAmount; originalMessage.currency = TransactionUtils.getCurrency(oldTransaction); From b83cd8058b4e94e1d7ae6cad31afeb4e5919d149 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Mon, 13 May 2024 18:11:26 +0530 Subject: [PATCH 2/2] Add a comment --- src/libs/ReportUtils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 4511b932458a..49d9f3741db0 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2983,6 +2983,8 @@ function getModifiedExpenseOriginalMessage( originalMessage.tag = transactionChanges?.tag; } + // We only want to display a tax amount update system message when tax amount is updated by user. + // Tax amount can change as a result of amount, currency or tax rate update. In such cases, we want to skip displaying a system message, as discussed. if ('taxAmount' in transactionChanges && !('amount' in transactionChanges || 'currency' in transactionChanges || 'taxCode' in transactionChanges)) { originalMessage.oldTaxAmount = TransactionUtils.getTaxAmount(oldTransaction, isFromExpenseReport); originalMessage.taxAmount = transactionChanges?.taxAmount;