Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
5 of 6 tasks
lanitochka17 opened this issue May 1, 2024 · 27 comments
Closed
5 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented May 1, 2024

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
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 1, 2024
Copy link

melvin-bot bot commented May 1, 2024

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.

@lanitochka17
Copy link
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

@lanitochka17
Copy link
Author

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

@bernhardoj
Copy link
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.

@alexpensify alexpensify added the External Added to denote the issue can be worked on by a contributor label May 3, 2024
@melvin-bot melvin-bot bot 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 May 3, 2024
Copy link

melvin-bot bot commented May 3, 2024

Job added to Upwork: https://www.upwork.com/jobs/~010f30064172acce83

@melvin-bot melvin-bot bot added Overdue Help Wanted Apply this label when an issue is open to proposals by contributors labels May 3, 2024
Copy link

melvin-bot bot commented May 3, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label May 3, 2024
@alexpensify
Copy link
Contributor

@hoangzinh - when you get a chance, can you review if this proposal will fix this issue? Thanks!


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

If anything urgent is needed here, please ask for help in the #expensify-open-source Slack Room-- thanks!

Copy link

melvin-bot bot commented May 7, 2024

@alexpensify, @hoangzinh Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label May 7, 2024
@alexpensify
Copy link
Contributor

@hoangzinh any update regarding the proposal? Thanks!

@hoangzinh
Copy link
Contributor

sorry for late update. @bernhardoj proposal looks good to me #41418 (comment). I think we should go with his main solution.

🎀👀🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label May 8, 2024
Copy link

melvin-bot bot commented May 8, 2024

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

@trjExpensify trjExpensify changed the title [$250] Tax - The tax amount of a manual IOU will be in negative format [$250] [Track Tax] The tax amount of a manual IOU will be in negative format May 8, 2024
@hayata-suenaga
Copy link
Contributor

the proposal looks good to me. we can return the absolute value 👍

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 8, 2024
Copy link

melvin-bot bot commented May 8, 2024

📣 @hoangzinh 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented May 8, 2024

📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels May 9, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @hoangzinh

@alexpensify
Copy link
Contributor

@hoangzinh, please keep us posted if you are unable to review this PR. Thanks!

@hoangzinh
Copy link
Contributor

@alexpensify I can review this PR today or tomorrow.

@alexpensify
Copy link
Contributor

Thank you for that update!

@alexpensify
Copy link
Contributor

@hoangzinh any news here? Thanks!

@hoangzinh
Copy link
Contributor

@bernhardoj opened PR and we're nearly done with the PR but the issue has been fixed in another PR #42039 already with the same solution with @bernhardoj. Therefore, I think we should put this issue on the regression period and process payment for Contributor and C+.

@alexpensify
Copy link
Contributor

Thanks for that summary!

@alexpensify
Copy link
Contributor

alexpensify commented May 17, 2024

Payouts due: TBD

Upwork job is here.

@alexpensify alexpensify removed their assignment May 17, 2024
@alexpensify alexpensify added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels May 17, 2024
Copy link

melvin-bot bot commented May 17, 2024

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.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 17, 2024
@alexpensify alexpensify self-assigned this May 17, 2024
@alexpensify alexpensify added Weekly KSv2 and removed Daily KSv2 labels May 17, 2024
@alexpensify
Copy link
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!

@greg-schroeder
Copy link
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

@alexpensify
Copy link
Contributor

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

@greg-schroeder
Copy link
Contributor

i gotchu @alexpensify!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Status: Done
Development

No branches or pull requests

6 participants