Skip to content

[Due for payment 2025-07-04] [$250] Report - Change workspace option not display in More of paid IOU Receiver #63819

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.1.63-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/6227168
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Device used: Win 11/Chrome
App Component: Money Requests

Action Performed:

  1. Open app
  2. Go to any DM 1:1 conversation
  3. Submit an expense to receiver
  4. At other browser, receiver go to this DM
  5. Click on "Pay amount elsewhere"
  6. Click on View of IOU
  7. Click on More

Expected Result:

Verify the options displayed are: Download , Change workspace, and View details

Actual Result:

The options displayed are: Download as CSV, Download as PDF and View details

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6855267_1749534608985.Recording__1115.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021932424648996266754
  • Upwork Job ID: 1932424648996266754
  • Last Price Increase: 2025-06-10
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @maddylewis

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 10, 2025
  2. melvin-bot commented on Jun 10, 2025

    @melvin-bot

    Triggered auto assignment to @maddylewis (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 10, 2025
  4. changed the title [-]Report - Change workspace option not display in More of paid IOU Receiver[/-] [+][$250] Report - Change workspace option not display in More of paid IOU Receiver[/+] on Jun 10, 2025
  5. melvin-bot commented on Jun 10, 2025

    @melvin-bot
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 10, 2025
  7. melvin-bot commented on Jun 10, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @ahmedGaber93 (External)

  8. daledah commented on Jun 10, 2025

    @daledah
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-06-10 21:10:10 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The options displayed are: Download as CSV, Download as PDF and View details

    What is the root cause of that problem?

    With iou expense, we only allow edit when it's an open report or processing report

    function isChangeWorkspaceAction(report: Report, policies: OnyxCollection<Policy>): boolean {
    const availablePolicies = Object.values(policies ?? {}).filter((newPolicy) => isWorkspaceEligibleForReportChange(newPolicy, report, policies));
    let hasAvailablePolicies = availablePolicies.length > 1;
    if (!hasAvailablePolicies && availablePolicies.length === 1) {
    hasAvailablePolicies = !report.policyID || report.policyID !== availablePolicies?.at(0)?.id;
    }
    const reportPolicy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
    return hasAvailablePolicies && canEditReportPolicy(report, reportPolicy);

    App/src/libs/ReportUtils.ts

    Lines 3853 to 3858 in a3e39d2

    const isOpen = isOpenReport(report);
    const isSubmitted = isProcessingReport(report);
    if (isIOUType) {
    return isOpen || isSubmitted;
    }

    What changes do you think we should make in order to solve the problem?

    1. We should allow to change workspace when it's manually reimbursed report
        const isOpen = isOpenReport(report);
        const isSubmitted = isProcessingReport(report);
        const isReimbursed = isReportManuallyReimbursed(report);
        if (isIOUType) {
            return isOpen || isSubmitted || isReimbursed;
        }
    

    App/src/libs/ReportUtils.ts

    Lines 3853 to 3858 in a3e39d2

    const isOpen = isOpenReport(report);
    const isSubmitted = isProcessingReport(report);
    if (isIOUType) {
    return isOpen || isSubmitted;
    }

    1. When it's manually reimbursed report, we don't need to check hasRequestFromCurrentAccount here. We need to update both moveIOUReportToPolicyAndInviteSubmitter and moveIOUReportToPolicy functions
        const isReimbursed = isReportManuallyReimbursed(iouReport);
        if (!isReimbursed && ReportActionsUtils.hasRequestFromCurrentAccount(reportID, iouReport.managerID ?? CONST.DEFAULT_NUMBER_ID)) {
            return;
        }
    

    App/src/libs/actions/Report.ts

    Lines 5125 to 5128 in a3e39d2

    // This flow only works for admins moving an IOU report to a policy where the submitter is NOT yet a member of the policy
    if (!isPolicyAdmin || !isIOUReportUsingReport(iouReport) || !submitterAccountID || !submitterEmail || isPolicyMember(submitterLogin, policyID)) {
    return;
    }

    App/src/libs/actions/Report.ts

    Lines 4950 to 4953 in a3e39d2

    // We do not want to create negative amount expenses
    if (ReportActionsUtils.hasRequestFromCurrentAccount(iouReport.reportID, iouReport.managerID ?? CONST.DEFAULT_NUMBER_ID)) {
    return;
    }

    Note: We can only change workspace if Policy and IOU must share the same payer. And it seems to be fixed in this PR

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We can add test for canEditReportPolicy function to cover this scenario

    What alternative solutions did you explore? (Optional)

    NA

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  9. ijmalik commented on Jun 10, 2025

    @ijmalik
    Contributor

    Please re-state the problem that we are trying to solve in this issue.

    The "Change Workspace" option is not appearing in the More menu for paid IOU reports where the user is the receiver

    What is the root cause of that problem?

    if (isChangeWorkspaceAction(report, policies)) {
    options.push(CONST.REPORT.SECONDARY_ACTIONS.CHANGE_WORKSPACE);
    }

    moveIOUReportToPolicy(reportID, policyID);

    App/src/libs/ReportUtils.ts

    Lines 3856 to 3858 in 26ae296

    if (isIOUType) {
    return isOpen || isSubmitted;
    }

    Current validation in ReportUtils.canChangeWorkspace() only allows:
    Open reports (isOpen)
    Submitted reports (isSubmitted)

    Missing check for reimbursed reports (isSettled)

    The moveIOUReportToPolicy function has protection logic that:
    Prevents moving unpaid negative expenses
    Doesn't properly account for settled reports

    What changes do you think we should make in order to solve the problem?

    Replace

    App/src/libs/ReportUtils.ts

    Lines 3854 to 3858 in 26ae296

    const isSubmitted = isProcessingReport(report);
    if (isIOUType) {
    return isOpen || isSubmitted;
    }

    const isReimbursed = isSettled(report?.reportID);    
    const isSubmitted = isProcessingReport(report);
    
        if (isIOUType) {
            return isOpen || isSubmitted || isReimbursed;
        }
    

    Replace

    App/src/libs/actions/Report.ts

    Lines 4951 to 4953 in 94e5927

    if (ReportActionsUtils.hasRequestFromCurrentAccount(iouReport.reportID, iouReport.managerID ?? CONST.DEFAULT_NUMBER_ID)) {
    return;
    }

        if (!isSettled(iouReport) && ReportActionsUtils.hasRequestFromCurrentAccount(iouReport.reportID, iouReport.managerID ?? CONST.DEFAULT_NUMBER_ID)) {
            return;
        }
    

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    Positive Cases: Ensure "Change Workspace" is available for IOU reports in OPEN, SUBMITTED, and REIMBURSED states.

    Negative Cases: Verify it’s blocked for unpaid reports where the current user owes money.

    What alternative solutions did you explore? (Optional)

    63819-1.mp4
  10. ahmedGaber93 commented on Jun 13, 2025

    @ahmedGaber93
    Contributor

    This part was refactored recently in #62062.

    Let's check with @luacmartins if this intentionally and the regression test is outdated, or the expected behavior here is correct.

  11. luacmartins commented on Jun 13, 2025

    @luacmartins
    Contributor

    The design doc says:

    In the case of a reimbursed IOU, the receiver sees:
    A More secondary button with Download , Change workspace, and View details

    So this seems like a valid issue

  12. self-assigned this
    on Jun 13, 2025
  13. 37 remaining items

  14. melvin-bot commented on Jul 7, 2025

    @melvin-bot

    @maddylewis Whoops! This issue is 2 days overdue. Let's get this updated quick!

  15. ahmedGaber93 commented on Jul 8, 2025

    @ahmedGaber93
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other: Applause Internal Team

    The issue was caught during regression testing, so no need to add another one

  16. maddylewis commented on Jul 8, 2025

    @maddylewis
    Contributor

    @daledah - bump on this - ty! #63819 (comment)

  17. daledah commented on Jul 8, 2025

    @daledah
    Contributor
  18. maddylewis commented on Jul 8, 2025

    @maddylewis
    Contributor
  19. melvin-bot commented on Jul 11, 2025

    @melvin-bot

    @maddylewis Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  20. maddylewis commented on Jul 11, 2025

    @maddylewis
    Contributor

    @daledah - will you accept the offer so i can send the payment / close this issue? thanks!

  21. daledah commented on Jul 11, 2025

    @daledah
    Contributor

    @maddylewis I accepted the offer, thank you 💯

  22. maddylewis commented on Jul 11, 2025

    @maddylewis
    Contributor

    paid!

  23. trjExpensify commented on Nov 5, 2025

    @trjExpensify
    Contributor

    approved $250 for @ahmedGaber93.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions