Skip to content

feat: add download receipts option to report - #96947

Merged
mollfpr merged 12 commits into
Expensify:mainfrom
truph01:feat/95356
Aug 3, 2026
Merged

feat: add download receipts option to report#96947
mollfpr merged 12 commits into
Expensify:mainfrom
truph01:feat/95356

Conversation

@truph01

@truph01 truph01 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #95356
PROPOSAL:

Tests

  1. Request two expenses with receipts to workspace.
  2. Open the expense report in step 1
  3. Click on "More" dropdown button and choose "Download receipts"
  4. Verify you can go to the download flow and can download the receipt successfully
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2026-07-31.at.13.34.03.mov
Android: mWeb Chrome
Screen.Recording.2026-07-31.at.13.38.51.mov
iOS: Native
Screen.Recording.2026-07-31.at.13.09.09.mov
iOS: mWeb Safari
Screen.Recording.2026-07-31.at.13.37.59.mov
MacOS: Chrome / Safari
Screen.Recording.2026-07-29.at.17.50.29.mov

@truph01
truph01 requested review from a team as code owners July 24, 2026 10:56
@melvin-bot

melvin-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@melvin-bot
melvin-bot Bot requested review from JmillsExpensify and daledah and removed request for a team July 24, 2026 10:56
@melvin-bot

melvin-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

@daledah Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@truph01

truph01 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 272c367568

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

},
[CONST.REPORT.SECONDARY_ACTIONS.DOWNLOAD_RECEIPTS]: {
value: CONST.REPORT.SECONDARY_ACTIONS.DOWNLOAD_RECEIPTS,
text: translate('common.downloadReceipts'),

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 Update all generated locales for receipts copy

When the user’s locale is one of the other supported locales (de/fr/it/ja/nl/pl/pt-BR/zh-hans), the new common.downloadReceipts and exportDownload.receiptsFailedBody keys are absent from those generated language files (checked with rg "downloadReceipts|receiptsFailedBody" src/languages/{de,fr,it,ja,nl,pl,pt-BR,zh-hans}.ts). translate() treats missing keys as an error in development and as missing/raw text in production/staging, so opening this new menu item or seeing the receipts failure state is broken outside en/es. Please regenerate/update every locale for both new keys.

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.

Resolved

@github-actions

Copy link
Copy Markdown
Contributor

🚧 JmillsExpensify has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@JmillsExpensify

Copy link
Copy Markdown
Contributor

Tried to test this but I don't see any Download receipts option.

Comment thread src/libs/ReportSecondaryActionUtils.ts Outdated

options.push(CONST.REPORT.SECONDARY_ACTIONS.DOWNLOAD_PDF);

options.push(CONST.REPORT.SECONDARY_ACTIONS.DOWNLOAD_RECEIPTS);

@daledah daledah Jul 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: missing empty-state handling for reports with no receipts

DOWNLOAD_RECEIPTS is pushed unconditionally so the option is shown even on reports made up entirely of manually expenses that have zero receipt images

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.

I resolved via 10b2715

@daledah

daledah commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@truph01 please fix the failing checks and fill the Tests section

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/index.ts 94.81% <ø> (ø)
src/libs/API/types.ts 100.00% <ø> (ø)
src/libs/PopoverMenuSections.ts 100.00% <ø> (ø)
src/libs/ReportSecondaryActionUtils.ts 95.46% <100.00%> (+0.01%) ⬆️
src/components/ExportDownloadStatusModal.tsx 89.47% <78.26%> (-7.14%) ⬇️
src/hooks/useExportActions.ts 59.52% <37.50%> (-2.32%) ⬇️
src/libs/actions/Export.ts 81.57% <0.00%> (-18.43%) ⬇️
... and 14 files with indirect coverage changes

@truph01

truph01 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Tried to test this but I don't see any Download receipts option.

@JmillsExpensify I added QA test, could you test again by following it?

@truph01

truph01 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@daledah I resolved your comments. Could you review again?

JmillsExpensify commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Not sure if we're addressing this later, though the first option should read: Download report. More on the product scope here: https://github.com/Expensify/Expensify/issues/653740.

CleanShot 2026-07-29 at 16.44.00@2x.png

Copy link
Copy Markdown
Contributor

Second feedback: If I try to download an eReceipt, then I go through the entire flow and it says it's successful, but it doesn't look like anything ever downloads.

Copy link
Copy Markdown
Contributor

Downloading a normal receipt works great. I got the zip and I unzipped successfully on my computer.

@truph01

truph01 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Not sure if we're addressing this later, though the first option should read: Download report. More on the product scope here: https://github.com/Expensify/Expensify/issues/653740.

@JmillsExpensify Is "Download report" a feature request? If so, I think it is out of scope for this issue.
The purpose of this issue is only to add "Download receipts" to the report.

@truph01

truph01 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Second feedback: If I try to download an eReceipt, then I go through the entire flow and it says it's successful, but it doesn't look like anything ever downloads.

@JmillsExpensify I think that's because, in step 1. Request two expenses with receipts to workspace, none of the expenses actually have a receipt attached, right?

I've updated the PR so that, if a report doesn't contain any expenses with receipts, the Download receipts button won't be shown.

@truph01

truph01 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@truph01

truph01 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@truph01 @daledah Let's do both. Keep the hasReceipt gate so we don't show a no-op option in the common case, and also handle the empty-state (exportType === 'receipts' && receiptCount === 0 → "No receipts to download"). The concrete case it covers: hasReceipt includes eReceipts, but the export only includes uploaded receipts — so a report whose expenses have only eReceipts comes back with 0 receipts, and the empty-state handles that gracefully. On eReceipts specifically: the FE issue didn't call out excluding them, and to users they read as receipts, so let's keep hasReceipt as-is and let the empty-state cover the nothing-to-download case. We can tighten later if needed.

@mollfpr @daledah I updated PR. Here is the result:

Screen.Recording.2026-07-30.at.17.46.31.mov

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 108a2a0e25

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const exportType = displayedExport?.exportType;
const failedReportCount = displayedExport?.failedReportCount ?? 0;
const reportCount = displayedExport?.reportCount ?? 0;
const receiptCount = displayedExport?.receiptCount;

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 Handle partial failures for receipt zips

When ExportReceiptsToZip finishes with a usable zip but some receipts failed, the export status includes a failedReceiptCount alongside receiptCount; this modal only reads receiptCount and the existing partial-failure branch only checks failedReportCount, so that case is shown as a full success and auto-downloads without warning that receipts are missing. Please carry the receipt failure count through the Onyx type and use it to render receipt-specific partial-failure copy before users rely on an incomplete archive.

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.

Resolved via ede5e7e

@truph01

truph01 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@daledah All good now. Could you review it again?

@github-actions

Copy link
Copy Markdown
Contributor

🚧 mollfpr has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

JmillsExpensify commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Works for me on Download report!

@daledah

daledah commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
android.mov
Android: mWeb Chrome
android-mweb.mov
iOS: HybridApp
ios.mov
iOS: mWeb Safari
ios-mweb.mov
MacOS: Chrome / Safari
Screen.Recording.2026-07-31.at.11.10.57.mov

@daledah

daledah commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@truph01 please merge main to fix the jest test


options.push(CONST.REPORT.SECONDARY_ACTIONS.DOWNLOAD_PDF);

if (reportTransactions.some(hasReceiptTransactionUtils)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@truph01 could you please add some unit tests to cover this logic?

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.

I added tests

@truph01

truph01 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@daledah All good now!

@daledah daledah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@melvin-bot
melvin-bot Bot requested a review from mollfpr July 31, 2026 07:54
@JmillsExpensify

Copy link
Copy Markdown
Contributor

Second feedback: If I try to download an eReceipt, then I go through the entire flow and it says it's successful, but it doesn't look like anything ever downloads.

@JmillsExpensify I think that's because, in step 1. Request two expenses with receipts to workspace, none of the expenses actually have a receipt attached, right?

I've updated the PR so that, if a report doesn't contain any expenses with receipts, the Download receipts button won't be shown.

Perfect, this is what I'd expect.

@JmillsExpensify JmillsExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me for the v1.

@mollfpr mollfpr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Thank you!

@mollfpr
mollfpr merged commit 2a55f3b into Expensify:main Aug 3, 2026
37 of 38 checks passed
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🚧 mollfpr has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

OSBotify commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

OSBotify commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mollfpr in version: 9.4.49-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

Help site review — changes required ✅

This PR adds a Download receipts option to the More menu on an expense report, which downloads all receipts on that report as a single zip file. That's a user-facing feature, so the help site needs an update.

Docs draft PR: #97740

What I documented

I added the new flow to How-to-Export-Reports.md — the existing article that already covers the report More menu (Export to CSV and Download as PDF):

  • New section: How to download the receipts on a report (open the report → MoreDownload receipts → the zip prepares and auto-downloads, with a Download file fallback).
  • Two FAQs: why the option may be hidden (it only appears when at least one expense on the report has a receipt), and what happens on partial failure.
  • Updated the article frontmatter (description, keywords, internalScope) to include receipts.

Verification note

I verified the label (Download receipts), the receipt-gated visibility, and the zip/auto-download behavior against the merged code. I could not confirm it in the live UI because the automated test account had no expense reports with receipts to open, so please double-check the wording matches the current UI.

@truph01, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants