Skip to content

Expense- Report field is disabled when per diem rates are removed, but Move to report is shown #85014

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: 9.3.36-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #84512
Email or phone of affected tester (no customers): sjodijsnodijdnoijsido@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Workspace has per diem rates.
  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create a per diem expense.
  4. Go to workspace settings > Per diem.
  5. Delete all per diem rates.
  6. Go back to self DM.
  7. Open the per diem expense.
    → Report field is disabled because per diem rates are removed - Expected.
  8. Click More > Move to report.

Expected Result:

Move to report should also be hidden as it has the same functionality as Report field.

Actual Result:

Report field is disabled when per diem rates are removed, but Move to report is shown.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7100484_1773281791704.17.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Mar 12, 2026
  2. melvin-bot commented on Mar 12, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #84512

  3. melvin-bot commented on Mar 12, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Mar 12, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Mar 12, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #84512 - "Feat: Add 'Move to report' in the 'More' menu of a one-expense report" by @nyomanjyotisa (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #84512 added the "Move to report" functionality but is missing a critical check for per diem expenses. When per diem rates are deleted from a workspace, the "Move to report" option should be hidden (just like the Report field is disabled), but the PR only checks canEditFieldOfMoneyRequest without the additional per diem validation.

    Labels: Removing DeployBlocker label (backend is not involved). Keeping DeployBlockerCash (App deploy blocked).

    Detailed Analysis

    Evidence

    The bug occurs when:

    1. A workspace has a per diem expense
    2. All per diem rates are deleted from the workspace
    3. The Report field correctly becomes disabled
    4. However, "Move to report" in More menu is still shown

    This is a regression introduced by PR #84512 which added "Move to report" functionality for single-expense reports.

    Verification

    In src/components/ReportActionItem/MoneyRequestView.tsx (lines 371-383), the Report field check includes:

    const canEditReport =
        isEditable &&
        canEditFieldOfMoneyRequest(...) &&
        (!isPerDiemRequest || canSubmitPerDiemExpenseFromWorkspace(policy) || (isExpenseUnreported && !!perDiemOriginalPolicy));

    The additional check (!isPerDiemRequest || canSubmitPerDiemExpenseFromWorkspace(policy) || ...) ensures per diem expenses cannot be moved when rates are deleted.

    However, PR #84512 added the "Move to report" functionality in:

    • src/libs/ReportSecondaryActionUtils.ts (lines 964-976 in the PR diff)
    • src/components/MoneyReportHeader.tsx
    • src/components/MoneyRequestHeader.tsx

    These locations only check canEditFieldOfMoneyRequest() and canUserPerformWriteAction(), but do NOT include the per diem rate validation that exists for the Report field.

    Root Cause

    The function canEditFieldOfMoneyRequest() in ReportUtils.ts handles the REPORT field edit permission (lines 4936-4989), but it does not check whether per diem rates still exist in the policy. This check is implemented separately in MoneyRequestView.tsx via canSubmitPerDiemExpenseFromWorkspace(policy).

    When PR #84512 added "Move to report", it reused canEditFieldOfMoneyRequest() without adding the additional per diem rate check, causing the inconsistency where:

    • Report field: disabled (has the check)
    • Move to report: shown (missing the check)

    Fix Requirements

    The fix should add the per diem rate validation to the "Move to report" logic, matching the Report field behavior:

    canMoveExpense && canUserPerformWriteAction && 
    (!isPerDiemRequest || canSubmitPerDiemExpenseFromWorkspace(policy) || (isExpenseUnreported && !!perDiemOriginalPolicy))

    This check needs to be added in:

    1. MoneyReportHeader.tsx - canMoveSingleExpense calculation
    2. MoneyRequestHeader.tsx - Secondary action filtering
    3. ReportSecondaryActionUtils.ts - Both getSecondaryReportActions and getSecondaryTransactionThreadActions
  6. MelvinBot commented on Mar 12, 2026

    @MelvinBot
    Contributor

    Proposal

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

    When per diem rates are deleted from a workspace, the Report field on an existing per diem expense is correctly disabled, but the "Move to report" option in the More menu remains visible. "Move to report" should be hidden because it has the same functionality as the Report field.

    What is the root cause of that problem?

    PR #84512 added the MOVE_EXPENSE secondary action to the "More" menu. The visibility check uses only canEditFieldOfMoneyRequest(reportAction, CONST.EDIT_REQUEST_FIELD.REPORT, ...), which does not check whether per diem rates are available on the policy.

    In contrast, the Report field in MoneyRequestView.tsx (line 371-383) layers an additional per diem guard on top of canEditFieldOfMoneyRequest:

    (!isPerDiemRequest || canSubmitPerDiemExpenseFromWorkspace(policy) || (isExpenseUnreported && !!perDiemOriginalPolicy))
    

    canSubmitPerDiemExpenseFromWorkspace (PolicyUtils.ts:1224-1227) returns false when per diem rates are removed because getPerDiemCustomUnit(policy) returns empty/undefined. This guard is what correctly disables the Report field — but this same guard is missing from the new MOVE_EXPENSE action in three places:

    1. ReportSecondaryActionUtils.ts — getSecondaryTransactionThreadActions (controls the "More" menu on individual expense view)
    2. ReportSecondaryActionUtils.ts — getSecondaryReportActions (controls the "More" menu on one-expense report view)
    3. MoneyReportHeader.tsx — canMoveSingleExpense (additional visibility check for the report-level "More" menu)

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

    Add the per diem rate availability check to the MOVE_EXPENSE visibility logic in ReportSecondaryActionUtils.ts, in both getSecondaryTransactionThreadActions and getSecondaryReportActions. Specifically, before pushing MOVE_EXPENSE, add a check: if the transaction is a per diem request (via isPerDiemRequest from TransactionUtils), also require that canSubmitPerDiemExpenseFromWorkspace(policy) returns true (from PolicyUtils). This mirrors the existing guard used by the Report field in MoneyRequestView.tsx.

    The same check should also be added to canMoveSingleExpense in MoneyReportHeader.tsx for consistency.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. luacmartins commented on Mar 12, 2026

    @luacmartins
    Contributor

    Fixed by this revert #84984. Closing.

  8. melvin-bot commented on Mar 17, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions