Repository navigation
Description
Problem
Duplicating an expense ignores the report you are looking at. The duplicate is routed to your default workspace, then to whatever report that workspace chat's iouReportID points at — usually the most recently created report from that chat. If you duplicate an expense while viewing an open, editable report, the copy can land on a different report or on a brand-new one.
That is surprising. People duplicate an expense to get a second copy here, next to the original.
Current behavior
- useExpenseActions.ts builds the duplicate with
targetPolicy: defaultExpensePolicyandtargetReport: getPolicyExpenseChat(accountID, defaultExpensePolicy.id)— the default expense policy, not the source expense's policy. - Duplicate.ts passes that workspace chat to
requestMoney, and MoneyRequestBuilder.ts resolves the target asallReports[`report_${chatReport.iouReportID}`]— one pointer, no list, no sorting. With two draft reports on the workspace, the second is never considered. shouldCreateNewMoneyRequestReportthen forces a new report when that pointer is missing, pending delete, or cannot accept transactions — so a third draft can appear instead of reusing an addable one.
Proposed behavior
When the source expense is already on a report and that report can accept the duplicate, target the source report. Fall back to today's default-workspace routing only when it cannot.
Roughly: pass the source expense's reportID (and its policy) as the explicit target when the source report is open or otherwise addable — reuse the same "can this report accept a transaction" check shouldCreateNewMoneyRequestReport already relies on, instead of adding a second definition.
Cases to cover
- Source report is submitted, approved, closed, or pending delete → keep current behavior, do not reopen a locked report.
- Source expense has no report (self-DM / tracked) → stays unreported, as today.
- Source report belongs to a workspace other than your default → the duplicate should follow the source report, not jump workspaces.
Related
- [Due for payment 2026-09-24] [Exploratory] Expense report- Create new expense added to new report instead of current draft report #99395 — new expense lands on a new report instead of the existing draft (manual-create path, same routing gap).
Reported in Slack.
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022108295391114710662
- Upwork Job ID: 2108295391114710662
- Last Price Increase: 2026-10-08
Activity
melvin-bot commentedon Sep 16, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thelullabyy (
External)melvin-bot commentedon Sep 16, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
melvin-bot commentedon Sep 21, 2026
@thelullabyy Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Sep 23, 2026
@thelullabyy Still overdue 6 days?! Let's take care of this!
melvin-bot commentedon Sep 25, 2026
@thelullabyy Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
thelullabyy commentedon Sep 27, 2026
@MelvinBot Please investigate and drop proposal
MelvinBot commentedon Sep 27, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Duplicating an expense while viewing an open expense report puts the copy on a different report, or a new one. It should stay on the report you are viewing.
What is the root cause of that problem?
Both "Duplicate expense" entry points always target the default workspace chat, never the source report:
useExpenseActions.ts:280-282) passestargetPolicy: defaultExpensePolicyandtargetReport: activePolicyExpenseChat.MoneyRequestHeaderSecondaryActions.tsx:295-297) does the same.When the target is a chat,
MoneyRequestBuilder.ts:1421-1432picks whateverchatReport.iouReportIDpoints to. If that report can't take the expense,shouldCreateNewMoneyRequestReportcreates a new one.The action layer already supports a specific report. If
reportis an expense report,requestMoneysetsmoneyRequestReportIDto it (TrackExpense.ts:1741-1743). The distance and per diem paths do the same. This is how "Add expense" inside a report works. The hooks just never pass the source report.What changes do you think we should make in order to solve the problem?
Choose the target in the two hooks.
Duplicate.tsneeds no changes.Add
canDuplicateIntoSourceReporttouseExpenseActionsandMoneyRequestHeaderSecondaryActions. It is true when all of these hold:!shouldCreateNewMoneyRequestReport(sourceReport, chatReport, false, isASAPSubmitBetaEnabled, rules, CONST.IOU.ACTION.CREATE, true)Reusing
shouldCreateNewMoneyRequestReport(it wrapscanAddTransaction) means the hook and the builder always agree. No second "addable" definition is needed.If true, use the source report and its policy as the target. Otherwise keep the default workspace chat and default policy.
Point everything that depends on the target at the chosen policy and report: categories, tags,
policyTagList, participants, and billing restriction checks.Compare the per diem cross-workspace block (
useExpenseActions.ts:230) against the target policy, not the default one.Close the menu when the copy lands on the viewed report: OR the new flag into
shouldDuplicateCloseModalOnSelect.This covers each case in the issue:
trackExpense.Tests:
tests/actions/IOUTest/DuplicateTest.ts, pass an open expense report astargetReport. Assert thatREQUEST_MONEYuses that report'siouReportID.useExpenseActionshook test withDuplicatemocked. An open source report should target itself. An approved source report should fall back to the default chat.What alternative solutions did you explore? (Optional)
existingIOUReportinstead: this skips the one-to-two-expenses handling thatrequestMoneyruns when it gets a report.iouReportIDpatching inDuplicate.tsassumes the target is a chat, so it's better handled as a follow-up.Related issue
[Due for payment 2026-09-24] [Exploratory] Expense report- Create new expense added to new report instead of current draft report (closed) has the same routing gap in the manual create path.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/101327)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Sep 30, 2026
@thelullabyy Whoops! This issue is 2 days overdue. Let's get this updated quick!
36 remaining items
mallenexpensify commentedon Oct 22, 2026
Please comment and tag me if/when payment is due, thx
jeffrey-graham commentedon Nov 7, 2026
melvin-bot commentedon Nov 7, 2026
expensify-chore-bot commentedon Nov 18, 2026
@francoisl, @shawnborton, @NikkiWines, @thelullabyy 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
expensify-chore-bot commentedon Nov 20, 2026
@francoisl, @shawnborton, @NikkiWines, @thelullabyy 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
expensify-chore-bot commentedon Nov 24, 2026
@thelullabyy 12 days overdue now... This issue's end is nigh!
expensify-chore-bot commentedon Nov 27, 2026
This issue has not been updated in over 14 days. @francoisl, @shawnborton, @NikkiWines, @thelullabyy eroding to Weekly issue.