From 0f3e679ef0778c82d17d2047804986686eee894d Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 23 Sep 2025 17:27:02 +0300 Subject: [PATCH 1/2] allow report level export for oneTransactionReports --- src/components/Search/index.tsx | 1 + src/components/Search/types.ts | 3 +++ src/pages/Search/SearchPage.tsx | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 58f80dbc8a7e..05f1f68cfb7e 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -184,6 +184,7 @@ function prepareTransactionsList( amount: Math.abs(item.modifiedAmount || item.amount), convertedAmount: item.convertedAmount, convertedCurrency: item.convertedCurrency, + isFromOneTransactionReport: item.isFromOneTransactionReport, }, }; } diff --git a/src/components/Search/types.ts b/src/components/Search/types.ts index e03fb612fa24..f759f440b1bd 100644 --- a/src/components/Search/types.ts +++ b/src/components/Search/types.ts @@ -41,6 +41,9 @@ type SelectedTransactionInfo = { /** The currency that the converted amount is in */ convertedCurrency: string; + + /** Whether it is the only expense of the parent expense report */ + isFromOneTransactionReport?: boolean; }; /** Model of selected transactions */ diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 32b3188b5b79..a2ea7acfc0f9 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -203,9 +203,12 @@ function SearchPage({route}: SearchPageProps) { const areFullReportsSelected = selectedTransactionReportIDs.length === selectedReportIDs.length && selectedTransactionReportIDs.every((id) => selectedReportIDs.includes(id)); const groupByReports = queryJSON?.groupBy === CONST.SEARCH.GROUP_BY.REPORTS; const typeInvoice = queryJSON?.type === CONST.REPORT.TYPE.INVOICE; + const typeExpense = queryJSON?.type === CONST.REPORT.TYPE.EXPENSE; + const isAllOneTransactionReport = Object.values(selectedTransactions).every((transaction) => transaction.isFromOneTransactionReport); // Add the report level export if fully reports are selected and we're on the report page - if ((groupByReports || typeInvoice) && areFullReportsSelected) { + // or if all the selected expenses are the only expenses of their parent expense report. + if (((groupByReports || typeInvoice) && areFullReportsSelected) || (typeExpense && !groupByReports && isAllOneTransactionReport)) { exportOptions.push({ text: translate('export.reportLevelExport'), icon: Expensicons.Table, From 93fb07b344af9fb741ff28335711c9d1ac70e119 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 30 Sep 2025 19:01:01 +0300 Subject: [PATCH 2/2] fix for selectAll case --- src/components/Search/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index e4033b77689a..83586263f35e 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -104,6 +104,7 @@ function mapTransactionItemToSelectedEntry( policyID: item.policyID, amount: item.modifiedAmount ?? item.amount, convertedAmount: item.convertedAmount, + isFromOneTransactionReport: item.isFromOneTransactionReport, convertedCurrency: item.convertedCurrency, }, ];