Skip to content

[$250] [Track Tax] The tax amount of a manual IOU will be in negative format #41418

Closed

Description

@lanitochka17

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: 1.4.69-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): sustinov@applausemail.com
Issue reported by: Applause - Internal Team

Issue found whene executing PR #41264

Action Performed:

  1. Open https://staging.new.expensify.com/
  2. Log in to your HT account
  3. Create a WS
  4. Enable "Taxes"
  5. Set "Tax Rate 1" as Workspace currency default
  6. Navigate to the WS room
  7. Create any manual IOU
  8. Create another manual IOU with a default currency and a Tax Rate 1
  9. Navigate to the details of the last IOU created
  10. Change the tax amount to any valid amount
  11. Start creating a new manual IOU
  12. Navigate to the tax amount entry menu

Expected Result:

The tax amount when creating a manual IOU should not be in a negative format

Actual Result:

After editing the Tax amount in an existing IOU, the next time a manual IOU is created, the Tax amount in the edit menu will be in negative format

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6467975_1714572153780.Recording__113.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010f30064172acce83
  • Upwork Job ID: 1786430749556625408
  • Last Price Increase: 2024-05-03
  • Automatic offers:
    • hoangzinh | Reviewer | 0
    • bernhardoj | Contributor | 0
Issue OwnerCurrent Issue Owner: @greg-schroeder

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 1, 2024
  2. melvin-bot commented on May 1, 2024

    @melvin-bot

    Triggered auto assignment to @alexpensify (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. lanitochka17 commented on May 1, 2024

    @lanitochka17
    Author

    @alexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

  4. lanitochka17 commented on May 1, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #wave-collect - Release 1

  5. bernhardoj commented on May 2, 2024

    @bernhardoj
    Contributor

    Proposal

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

    The tax amount is shown in negative value.

    What is the root cause of that problem?

    The tax amount is taken from getTaxAmount.

    function getTaxAmount(transaction: OnyxEntry<Transaction>, isFromExpenseReport: boolean): number {
    // IOU requests cannot have negative values but they can be stored as negative values, let's return absolute value
    if (!isFromExpenseReport) {
    return Math.abs(transaction?.taxAmount ?? 0);
    }
    // To avoid -0 being shown, lets only change the sign if the value is other than 0.
    const amount = transaction?.taxAmount ?? 0;
    return amount ? -amount : 0;
    }

    For an expense report, we negate the amount value. The reason is explained in the comment in getAmount, that is, the amount for the expense report is stored in negative value.

    // Expense report case:
    // The amounts are stored using an opposite sign and negative values can be set,
    // we need to return an opposite sign than is saved in the transaction object

    That's true, but it's only when the request is created.

    App/src/libs/actions/IOU.ts

    Lines 1817 to 1818 in c5a1f96

    let optimisticTransaction = TransactionUtils.buildOptimisticTransaction(
    ReportUtils.isExpenseReport(iouReport) ? -amount : amount,

    While we are creating the request, the amount is still in positive value, so negating it will give us a negative tax amount.

    This doesn't happen on the amount page because we always return the absolute value.

    amount={Math.abs(transactionAmount)}

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

    Do the same as what we did on the amount page, that is return the absolute value of the amount.
    Math.abs(transactionDetails?.taxAmount)

    What alternative solutions did you explore? (Optional)

    If we are creating a new request, don't negate the amount value.

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 3, 2024
  7. changed the title [-]Tax - The tax amount of a manual IOU will be in negative format[/-] [+][$250] Tax - The tax amount of a manual IOU will be in negative format[/+] on May 3, 2024
  8. melvin-bot commented on May 3, 2024

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 3, 2024
  10. melvin-bot commented on May 3, 2024

    @melvin-bot

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

  11. 28 remaining items

  12. added
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 17, 2024
  13. melvin-bot commented on May 17, 2024

    @melvin-bot

    Triggered auto assignment to @greg-schroeder (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.

  14. self-assigned this
    on May 17, 2024
  15. alexpensify commented on May 17, 2024

    @alexpensify
    Contributor

    Heads up, I will be offline until Tuesday, May 28, 2024, and will not actively watch over this GitHub during that period.

    @greg-schroeder - Here is the payment summary - #41418 (comment). While I'm offline, I need help here completing the payment process after this one clears the 7-day period. Thanks!

  16. greg-schroeder commented on May 21, 2024

    @greg-schroeder
    Contributor

    Hmm. Honestly, I don't think we need to put this in the regression period for #42039 as the contributors in this issue aren't necessarily beholden to that code's performance. And any regressions will be handled by the authors of that PR. I'll pay out the offers for your work now @hoangzinh @bernhardoj

  17. alexpensify commented on May 28, 2024

    @alexpensify
    Contributor

    Thanks, @greg-schroeder, for your help here!

  18. greg-schroeder commented on May 28, 2024

    @greg-schroeder
    Contributor

    i gotchu @alexpensify!

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.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions