Skip to content

[Due for payment 2025-11-13] [$250] Report - "Outstanding" seen as status when cancelling payment offline with approvals disabled #72750

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.32-0
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-1308/41237180/955761177?q=cancel+payment&issue_type=jira
Email or phone of affected tester (no customers): ibellicotest+1930@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 / Android 12 / Chrome ( mWeb / Hybrid app) - Windows 11 / Chrome
App Component: Money Requests

Action Performed:

Prerequisite: Account has at least one workspace.
Prerequisite 2: Delayed submissions enabled and approvals disabled.

  1. Open the Expensify app.
  2. Open any workspace chat.
  3. Create a manual expense.
  4. Tap on "Submit" on expense preview.
  5. Note that status changes to "Done".
  6. Mark expense as paid.
  7. Turn off internet connection.
  8. Open the expense report.
  9. Tap on "More" and cancel the payment.
  10. Note that status changes from "Paid" to "Outstanding" instead of returning to "Done".

Expected Result:

When payment of an expense is cancelled, status should change to "Done" instead of "Outstanding" if approvals are disabled.

Actual Result:

When payment of an expense is cancelled while in offline mode, status changes from "Paid" to "Outstanding" instead of returning to "Done" if approvals are disabled.

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

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021981145445472469112
  • Upwork Job ID: 1981145445472469112
  • Last Price Increase: 2025-10-29
Issue OwnerCurrent Issue Owner: @strepanier03

Activity

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

    @melvin-bot

    Triggered auto assignment to @strepanier03 (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. mohammadjafarinejad commented on Oct 16, 2025

    @mohammadjafarinejad
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-10-27 18:18:33 UTC.

    Proposal

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

    When payment of an expense is cancelled while in offline mode, status changes from "Paid" to "Outstanding" instead of returning to "Done" if approvals are disabled.

    What is the root cause of that problem?

    PR #56950 fixed the disappearing delete button (#55319) by keeping reports as SUBMITTED/SUBMITTED after payment cancellation. However, this causes #72750: the report incorrectly shows "Outstanding" (awaiting approval) even when approvals are disabled.

    Root cause: The status logic can't distinguish between:

    SUBMITTED/SUBMITTED genuinely awaiting approval → should show "Outstanding"

    SUBMITTED/SUBMITTED from a cancelled payment with no approvals → should show "Done"

    The conflict:

    Setting the state to APPROVED/CLOSED after cancellation shows the correct status, but breaks the delete button (only works in OPEN/PROCESSING states)

    Setting the state to SUBMITTED/SUBMITTED preserves the delete button but displays the wrong status

    App/src/libs/actions/IOU.ts

    Lines 10833 to 10834 in b1a71fc

    const stateNum: ValueOf<typeof CONST.REPORT.STATE_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.APPROVED;
    const statusNum: ValueOf<typeof CONST.REPORT.STATUS_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATUS_NUM.SUBMITTED : CONST.REPORT.STATUS_NUM.APPROVED;

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

    Solution 1

    Update getReportStatusTranslation() to accept an optional isCancelledIOU & approvalMode parameters, we can also update getReportStatusColorStyle()

        if (stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED) {
            // If payment was cancelled and approvals are disabled (OPTIONAL mode), show "Done" instead of "Outstanding"
            // For BASIC/ADVANCED modes, the report should still show "Outstanding" even after cancellation since it needs approval
            if (isCancelledIOU && approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL) {
                // eslint-disable-next-line @typescript-eslint/no-deprecated
                return translateLocal('common.done');
            }
            // eslint-disable-next-line @typescript-eslint/no-deprecated
            return translateLocal('common.outstanding');
        }

    App/src/libs/ReportUtils.ts

    Lines 12036 to 12038 in e6da175

    if (stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED) {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    return translateLocal('common.outstanding');


    Solution 2

    1. In cancelPayment() (IOU.ts): Set state to APPROVED/CLOSED for OPTIONAL approval mode.
        const stateNum: ValueOf<typeof CONST.REPORT.STATE_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.APPROVED : CONST.REPORT.STATE_NUM.APPROVED;
        const statusNum: ValueOf<typeof CONST.REPORT.STATUS_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.APPROVED;
    1. In canDeleteMoneyRequestReport() (ReportUtils.ts): Add an exception to allow deletion from APPROVED/CLOSED state only when the policy has OPTIONAL approval mode enabled (no approvals required)
    // Allow deletion if report is open/processing, or if it's an APPROVED/CLOSED report with OPTIONAL approval mode (cancelled payment)
    const isOptionalApprovalCancelled =
                report.stateNum === CONST.REPORT.STATE_NUM.APPROVED &&
                report.statusNum === CONST.REPORT.STATUS_NUM.CLOSED &&
                policy?.approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL;
    
    return isReportSubmitter && (isReportOpenOrProcessing || isOptionalApprovalCancelled) && !isForwarded;

    App/src/libs/ReportUtils.ts

    Lines 2758 to 2762 in e6da175

    const isReportSubmitter = isCurrentUserSubmitter(report);
    const isApprovalEnabled = policy ? policy.approvalMode && policy.approvalMode !== CONST.POLICY.APPROVAL_MODE.OPTIONAL : false;
    const isForwarded = isProcessingReport(report) && isApprovalEnabled && !isAwaitingFirstLevelApproval(report);
    return isReportSubmitter && isReportOpenOrProcessing && !isForwarded;

    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. nyomanjyotisa commented on Oct 16, 2025

    @nyomanjyotisa
    Member

    Proposal

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

    Report - "Outstanding" seen as status when cancelling payment offline with approvals disabled

    What is the root cause of that problem?

    When determining the state and status after cancelling payment, the code uses this logic:

    App/src/libs/actions/IOU.ts

    Lines 10845 to 10847 in 825fb54

    const approvalMode = policy?.approvalMode ?? CONST.POLICY.APPROVAL_MODE.BASIC;
    const stateNum: ValueOf<typeof CONST.REPORT.STATE_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.APPROVED;
    const statusNum: ValueOf<typeof CONST.REPORT.STATUS_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATUS_NUM.SUBMITTED : CONST.REPORT.STATUS_NUM.APPROVED;

    When approvals are disabled (OPTIONAL), the report is set to stateNum = SUBMITTED and statusNum = SUBMITTED, which according to getReportStatusTranslation displays as "Outstanding"

    App/src/libs/ReportUtils.ts

    Lines 11964 to 11966 in 825fb54

    if (stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED) {
    return translateLocal('common.outstanding');
    }

    However, when approvals are disabled, the expected behavior is that cancelled payments should show "Done" status, which corresponds to stateNum = APPROVED and statusNum = CLOSED:

    App/src/libs/ReportUtils.ts

    Lines 11967 to 11969 in 825fb54

    if (stateNum === CONST.REPORT.STATE_NUM.APPROVED && statusNum === CONST.REPORT.STATUS_NUM.CLOSED) {
    return translateLocal('common.done');
    }

    The problem is that the logic treats OPTIONAL (disabled approvals) the same as if the report was just submitted, rather than treating it as a completed report

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

    Change the logic in cancelPayment to set the correct state and status for reports with disabled approvals. When approvals are disabled, cancelling payment should result in "Done" status (APPROVED/CLOSED), not "Outstanding" status (SUBMITTED/SUBMITTED)

        const stateNum: ValueOf<typeof CONST.REPORT.STATE_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.APPROVED : CONST.REPORT.STATE_NUM.APPROVED;
        const statusNum: ValueOf<typeof CONST.REPORT.STATUS_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.APPROVED;

    App/src/libs/actions/IOU.ts

    Lines 10846 to 10847 in 825fb54

    const stateNum: ValueOf<typeof CONST.REPORT.STATE_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.APPROVED;
    const statusNum: ValueOf<typeof CONST.REPORT.STATUS_NUM> = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATUS_NUM.SUBMITTED : CONST.REPORT.STATUS_NUM.APPROVED;

    What alternative solutions did you explore? (Optional)

    None

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 22, 2025
  6. changed the title [-]Report - "Outstanding" seen as status when cancelling payment offline with approvals disabled[/-] [+][$250] Report - "Outstanding" seen as status when cancelling payment offline with approvals disabled[/+] on Oct 22, 2025
  7. melvin-bot commented on Oct 22, 2025

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

    @melvin-bot

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

  10. strepanier03 commented on Oct 22, 2025

    @strepanier03
    Contributor

    Reproducible pretty easily.

  11. 31 remaining items

  12. strepanier03 commented on Nov 13, 2025

    @strepanier03
    Contributor

    Payment summary

    For: #73936

  13. strepanier03 commented on Nov 13, 2025

    @strepanier03
    Contributor

    @suneox - I'll take the hold off the payment summary after I make the reg test, thanks!

  14. strepanier03 commented on Nov 17, 2025

    @strepanier03
    Contributor

    Friendly bump on the checklist @suneox

  15. suneox commented on Nov 20, 2025

    @suneox
    Contributor

    BugZero Checklist

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: It looks like the backend logic has been updated, so the frontend needs to be updated accordingly to match it.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Precondition:

    • Account has at least one workspace.
    • Workspace with delayed submissions enabled and approvals disabled

    Test:

    1. Create a manual expense in the workspace
    2. Submit the expense - verify status shows "Done"
    3. Mark the expense as paid - verify status shows "Paid"
    4. Turn off internet connection (enable airplane mode)
    5. Open the expense report header
    6. Tap on "More" menu and select "Cancel payment"
    7. Verify status changes from "Paid" to "Done" (NOT "Outstanding")
    8. Turn internet connection back on
    9. Verify sync completes and status remains "Done"

    Do we agree 👍 or 👎

  16. strepanier03 commented on Nov 21, 2025

    @strepanier03
    Contributor

    Thanks @suneox - I removed the hold from the payment summary so go ahead and request if you haven't already.

  17. garrettmknight commented on Dec 7, 2025

    @garrettmknight
    Contributor

    $250 approved for @suneox

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