Skip to content

[Due for payment 2025-06-02] [$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline #61050

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.1.33-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: No, reproducible on hybrid only
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): applausetester+290404kh@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.3 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Invoice feature is enabled.
  1. Go to staging.new.expensify.com
  2. Go offline.
  3. Go to FAB > Send invoice.
  4. Enter amount > Next.
  5. Select any user > Next.
  6. Click Send invoice.
  7. Go to invoice thread.
  8. Click Amount.
  9. Edit the amount and save it.

Expected Result:

The new amount in invoice thread header will match the edited amount.

Actual Result:

The new amount in invoice thread header is not the same as the edited amount when edited offline.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • 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/~021917347146786979910
  • Upwork Job ID: 1917347146786979910
  • Last Price Increase: 2025-04-29
  • Automatic offers:
    • mkzie2 | Contributor | 107137054
Issue OwnerCurrent Issue Owner: @mkzie2

Activity

  1. added
    Bug
    Daily
    on Apr 29, 2025
  2. melvin-bot commented on Apr 29, 2025

    @melvin-bot

    Triggered auto assignment to @lydiabarclay (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. mkzie2 commented on Apr 29, 2025

    @mkzie2
    Contributor

    Proposal

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

    The new amount in invoice thread header is not the same as the edited amount when edited offline.

    What is the root cause of that problem?

    The invoice report's total and transaction amount should be negative (compared to BE final response) but they are optimistically positive. Leading to the total calculation logic here to be incorrect:

    App/src/libs/actions/IOU.ts

    Lines 3842 to 3847 in 59cb784

    } else if ((isExpenseReport(iouReport) || isInvoiceReportReportUtils(iouReport)) && !Number.isNaN(iouReport.total) && iouReport.total !== undefined) {
    // For expense report, the amount is negative, so we should subtract total from diff
    updatedMoneyRequestReport = {
    ...iouReport,
    total: iouReport.total - diff,
    };

    So for example, the previous total is 100, the updated one is 200, so the diff is 100, and by the above logic, the calculated updated total is 100 - 100 = 0. The previous total should have been negative as the comment in the above snippet suggested.

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

    Update buildOptimisticInvoiceReport here and buildOptimisticTransaction in getSendInvoiceInformation here to build with negative amounts.

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

    NA

    What alternative solutions did you explore? (Optional)

    Update the IOUTest's sendInvoice test case here to include update amount with same currency case.

  4. added
    External
    on Apr 29, 2025
  5. melvin-bot commented on Apr 29, 2025

    @melvin-bot
  6. changed the title [-]Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/-] [+][$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/+] on Apr 29, 2025
  7. added
    Help Wanted
    on Apr 29, 2025
  8. melvin-bot commented on Apr 29, 2025

    @melvin-bot

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

  9. hoangzinh commented on May 1, 2025

    @hoangzinh
    Contributor

    @mkzie2's proposal looks good to me.

    Link to proposal #61050 (comment)

    🎀👀🎀 C+ reviewed

  10. melvin-bot commented on May 1, 2025

    @melvin-bot

    Triggered auto assignment to @luacmartins, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  11. 9 remaining items

  12. added
    Weekly
    and removed
    Daily
    on May 6, 2025
  13. mkzie2 commented on May 6, 2025

    @mkzie2
    Contributor

    Oh lucky for me it was fixed elsewhere. PR ready for review.

  14. melvin-bot commented on Jun 2, 2025

    @melvin-bot

    This issue has not been updated in over 15 days. @hoangzinh, @luacmartins, @mkzie2, @lydiabarclay eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  15. mkzie2 commented on Jun 2, 2025

    @mkzie2
    Contributor

    @lydiabarclay @luacmartins PR #61361 hit production 3 weeks ago. Ready for payment.

  16. hoangzinh commented on Jun 2, 2025

    @hoangzinh
    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:
    • [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: https://github.com/Expensify/App/pull/40015/files#r2121223051

    • [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.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/507069

    Regression Test Proposal

    Precondition:

    • Invoice feature is enabled for workspace.

    Test:

    1. Go offline.
    2. Go to FAB > Send invoice.
    3. Enter amount > Next.
    4. Select any user > Next.
    5. Click Send invoice.
    6. Go to invoice thread.
    7. Click Amount.
    8. Edit the amount and save it.
    9. Verify the invoice amount in report header matches actual invoice amount

    Do we agree 👍 or 👎

  17. lydiabarclay commented on Jun 2, 2025

    @lydiabarclay
    Contributor

    @mkzie2 I had to make a new job posting because the other expired, offer sent to you!

  18. lydiabarclay commented on Jun 2, 2025

    @lydiabarclay
    Contributor

    Payment Summary

    Contributor: @mkzie2 paid $250 via Upwork
    Contributor+: @hoangzinh due $250 via NewDot

    ✅ Regression test filed

  19. changed the title [-][$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/-] [+][Due for payment 2025-06-02] [$250] Invoice- Amount in invoice thread header is not the same as invoice amount when edited offline[/+] on Jun 2, 2025
  20. hoangzinh commented on Jun 3, 2025

    @hoangzinh
    Contributor

    Requested in ND

  21. garrettmknight commented on Jun 3, 2025

    @garrettmknight
    Contributor

    $250 approved for @hoangzinh

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

Metadata

Metadata

Labels

BugExternalMonthlyReviewing

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions