diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 7a72df9f1d87..6a2885814540 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7049,9 +7049,19 @@ function canApproveIOU(iouReport: OnyxTypes.OnyxInputOrEntry, const iouSettled = ReportUtils.isSettled(iouReport?.reportID); const reportNameValuePairs = ReportUtils.getReportNameValuePairs(iouReport?.reportID); const isArchivedReport = ReportUtils.isArchivedRoom(iouReport, reportNameValuePairs); - const unheldTotalIsZero = iouReport && iouReport.unheldTotal === 0; + let isTransactionBeingScanned = false; + const reportTransactions = TransactionUtils.getAllReportTransactions(iouReport?.reportID); + for (const transaction of reportTransactions) { + const hasReceipt = TransactionUtils.hasReceipt(transaction); + const isReceiptBeingScanned = TransactionUtils.isReceiptBeingScanned(transaction); + + // If transaction has receipt (scan) and its receipt is being scanned, we shouldn't be able to Approve + if (hasReceipt && isReceiptBeingScanned) { + isTransactionBeingScanned = true; + } + } - return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport && !unheldTotalIsZero; + return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport && !isTransactionBeingScanned; } function canIOUBePaid(