Skip to content

[Due for payment 2025-11-26] [$250] Report field is empty when per diem expense is moved to a workspace without per diem rates #73574

Closed

Description

@jponikarchuk

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: 9.2.38-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1469/folder/13176670/41237098/972471002
Email or phone of affected tester (no customers): applausetester+251011kh@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Create two workspaces - A and B.
  • Workspace A has per diem rates.
  • Workspace B does not have per diem rates.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat A.
  3. Create a per diem expense.
  4. Open the expense report.
  5. Click More > Change workspace.
  6. Select Workspace B.
  7. After changing workspace, click Report field.

Expected Result:

Report field will show the current report in which the per diem expense is located and also highlight it.

Actual Result:

Report field does not show the current report. Only Create report button is shown.

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

Bug6985022_1761497913172.10.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021983657569312187824
  • Upwork Job ID: 1983657569312187824
  • Last Price Increase: 2025-11-12
Issue OwnerCurrent Issue Owner: @Pujan92

Activity

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

    @melvin-bot

    Triggered auto assignment to @heyjennahay (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. Eskalifer1 commented on Oct 27, 2025

    @Eskalifer1
    Contributor

    Proposal

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

    Report field is empty when per diem expense is moved to a workspace without per diem rates

    What is the root cause of that problem?

    We are filtering all reports if policy is not have enabled PerDiem here:

    .filter((report) => {
    if (isPerDiemRequest && report?.policyID) {
    const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
    return canSubmitPerDiemExpenseFromWorkspace(policy);
    }
    return true;
    })

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

    We should not filter this item if its the same as selected report:

    if (isPerDiemRequest && report?.policyID && selectedReport?.reportID !== report?.reportID)

    What alternative solutions did you explore? (Optional)

    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.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 29, 2025
  5. changed the title [-]Report field is empty when per diem expense is moved to a workspace without per diem rates[/-] [+][$250] Report field is empty when per diem expense is moved to a workspace without per diem rates[/+] on Oct 29, 2025
  6. melvin-bot commented on Oct 29, 2025

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

    @melvin-bot

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

  9. nabi-ebrahimi commented on Nov 3, 2025

    @nabi-ebrahimi

    Proposal

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

    Report field is empty when per diem expense is moved to a workspace without per diem rates.

    What is the root cause of that problem?

    After moving Expense to another workspace, the destination workspace does not support per diem, so the current report and related actions (e.g., Remove from report) disappears from the list.

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

    Always allow the currently selected report to appear even if the new workspace doesn’t support per diem. This keeps the Report field and its actions (like “Remove from report”) working as expected.

    Add the following code inside the IOURequestEditReportCommon:

    if (isPerDiemRequest && report?.policyID) {
    +    if (report.reportID === selectedReportID) {
    +        return true;
    +    }
        // other code
    }

    .filter((report) => {
    if (isPerDiemRequest && report?.policyID) {
    const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
    return canSubmitPerDiemExpenseFromWorkspace(policy);
    }
    return true;
    })

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

    • Per diem expense moved to a non‑per‑diem workspace: current report is visible and selected; “Remove from report” and “Create report” options are present.
    • Per diem expense in a per‑diem workspace: eligible reports are listed; current report visible.
    • Non‑per‑diem expense: behavior unchanged; no regression in report list.
    • “Create report” flow still works when no eligible reports exist besides the current report.

    What alternative solutions did you explore? (Optional)

    • Alternative 1: Centralize logic in PolicyUtils
      Idea: Let the helper ignore per diem limits for the current report.

    In the canSubmitPerDiemExpenseFromWorkspace

    App/src/libs/PolicyUtils.ts

    Lines 882 to 885 in e4ceb35

    function canSubmitPerDiemExpenseFromWorkspace(policy: OnyxEntry<Policy>): boolean {
    const perDiemCustomUnit = getPerDiemCustomUnit(policy);
    return !!policy?.isPolicyExpenseChatEnabled && !isEmptyObject(perDiemCustomUnit) && !!perDiemCustomUnit?.enabled;
    }

    Add this:

    function canSubmitPerDiemExpenseFromWorkspace(policy: OnyxEntry<Policy>, opts?: {allowCurrentReport?: boolean}): boolean {
    +    if (opts?.allowCurrentReport) return true;
    // other code
    }

    And inside the IOURequestEditReportCommon:

    .filter((report) => {
    if (isPerDiemRequest && report?.policyID) {
    const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
    return canSubmitPerDiemExpenseFromWorkspace(policy);
    }
    return true;
    })

    Add this:

    if (isPerDiemRequest && report?.policyID) {
        const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
        return canSubmitPerDiemExpenseFromWorkspace(policy, {
    +        allowCurrentReport: report.reportID === selectedReportID,
        });
    }
  10. 33 remaining items

  11. Eskalifer1 commented on Nov 27, 2025

    @Eskalifer1
    Contributor

    Hi @heyjennahay, thank you! I have accepted

  12. heyjennahay commented on Nov 27, 2025

    @heyjennahay
    Contributor

    Payment of $250 sent to @Eskalifer1 via Upwork and ended the contract

    @Pujan92 assigning this issue to you, once you've submitted your payment request you can close the issue.

    Thanks everyone for your work!

  13. Pujan92 commented on Nov 27, 2025

    @Pujan92
    Contributor

    @heyjennahay I have requested the payment in ND. You can close the issue as I can't close it.

  14. m-natarajan commented on Nov 27, 2025

    @m-natarajan

    @Pujan92 @heyjennahay Unable to click the report field as per the regression step proposal (Step 6)

    Recording.1990.mp4
  15. trjExpensify commented on Nov 27, 2025

    @trjExpensify
    Contributor

    approved $250 for @Pujan92.

  16. Pujan92 commented on Nov 28, 2025

    @Pujan92
    Contributor

    @m-natarajan the latest PR change is disabling the report field.

  17. m-natarajan commented on Nov 28, 2025

    @m-natarajan

    @Pujan92 Thanks, Can you please update the regression step proposal (Step 6)

  18. Pujan92 commented on Dec 1, 2025

    @Pujan92
    Contributor

    @m-natarajan as we are restricting editing the report for this case now, we can remove the regression test bcoz now user won't be able to land on the report edit of per diem expense request.

  19. melvin-bot commented on Dec 4, 2025

    @melvin-bot

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

  20. Pujan92 commented on Dec 11, 2025

    @Pujan92
    Contributor

    @heyjennahay we can close this issue now.

  21. heyjennahay commented on Dec 11, 2025

    @heyjennahay
    Contributor

    Thank you!

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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions