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] Tax currency is editable for employee, and it reverts to default currency after creation #40593

Closed
6 tasks done
lanitochka17 opened this issue Apr 19, 2024 · 35 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Apr 19, 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.63-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
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • User is an employee of Collect workspace
  • Collect workspace has some tax rates
  1. Go to staging.new.expensify.com
  2. Go to workspace chat
  3. Go to + > Submit expense > Distance
  4. Proceed to confirmation page
  5. Note that distance amount cannot be edited
  6. Click Show more > Tax amount
  7. Click on the currency

Expected Result:

Since workspace employee is unable to edit the distance amount, they should not be able to edit tax currency

Actual Result:

Workspace employee is able to edit tax currency for distance request. After the request is created, the tax currency reverts to the workspace default currency

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

Bug6454202_1713469646447.20240419_034127.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bf4f1d5c88c460fe
  • Upwork Job ID: 1782480122275028992
  • Last Price Increase: 2024-05-28
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 19, 2024
Copy link

melvin-bot bot commented Apr 19, 2024

Triggered auto assignment to @CortneyOfstad (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

@CortneyOfstad 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

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Apr 19, 2024

Proposal

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

Tax - Tax currency is editable for employee, and it reverts to default currency after creation

What is the root cause of that problem?

The main problem with issue is that we can't change amount when it's DistanceRequest

{
item: (
<MenuItemWithTopDescription
key={translate('iou.amount')}
shouldShowRightIcon={!isReadOnly && !isDistanceRequest}
title={formattedAmount}
description={translate('iou.amount')}
interactive={!isReadOnly}
onPress={() => {
if (isDistanceRequest) {
return;
}
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_AMOUNT.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRouteWithoutParams()));
}}
style={[styles.moneyRequestMenuItem, styles.mt2]}
titleStyle={styles.moneyRequestConfirmationAmount}
disabled={didConfirm}
brickRoadIndicator={shouldDisplayFieldError && TransactionUtils.isAmountMissing(transaction ?? null) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
error={shouldDisplayFieldError && TransactionUtils.isAmountMissing(transaction ?? null) ? translate('common.error.enterAmount') : ''}
/>
),
shouldShow: shouldShowSmartScanFields,
isSupplementary: false,
},

But we don't have this condition for taxAmount

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

To fix this issue we can disable taxAmount (optional taxRate) when it's DistanceRequest using the same logic as for amount

{
item: (
<MenuItemWithTopDescription
key={`${taxRates?.name}${formattedTaxAmount}`}
shouldShowRightIcon={!isReadOnly}
title={formattedTaxAmount}
description={translate('iou.taxAmount')}
style={[styles.moneyRequestMenuItem]}
titleStyle={styles.flex1}
onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_TAX_AMOUNT.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRouteWithoutParams()))}
disabled={didConfirm}
interactive={!isReadOnly}
/>
),
shouldShow: shouldShowTax,
isSupplementary: true,
},

What alternative solutions did you explore? (Optional)

NA

@allgandalf
Copy link
Contributor

The expected result is wrong IMO, we should indeed be able to edit taxes on any distance request, so I will propose my solution accordingly.

Proposal

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

There is a mismatch in currency of amount and tax rate.

What is the root cause of that problem?

When we update tax rate currency at the same time we need to update the currency of the amount as well, currently we do not update the currency of amount, this happens because we have a check for formattedAmount which will set the currency to currency prop, instead of iouCurrencyCode:

isDistanceRequest ? currency : iouCurrencyCode,

This formattedAmount is used to display the amount of distance request.

Screenshot 2024-04-20 at 6 47 43 AM

Observe the currency of tax amount and amount, you'll see currency mismatch after we update the currency of tax request.

Now these values are sent to the BE with different currencies and hence we see weird texts on the money report details page. This is the RCA for the actual bug.

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

We should always set currency to iouCurrencyCode, whatever the request type may be, so we should remove isDistanceRequest from the above.

This is safe to do as the currency does change for tax amount as well as amount if any one of the two is edited for manual requests:

Screen.Recording.2024-04-20.at.6.49.29.AM.mov

Hence, we should allow the same for distance requests as well.

So we should change the currency of amount as well if we update the currency of Tax Rate

What alternative solutions did you explore? (Optional)

N/A

NOTE:

If we decide to go with original bug expectation then here's my solution:

The RCA is that we do not mark the tax rate and tax amount as non editable if the request is of distance type

Solution:

I propose that we shouldn't disable(this is done using shouldShow field) the tax rate and tax amount but instead we should mark both these field as non editable by adding an extra condition of !isDistanceRequest for shouldShowRightIcon (shouldShowRightIcon is used to mark the field as editable) if the request type is Distance below:

<MenuItemWithTopDescription
key={`${taxRates?.name}${taxRateTitle}`}
shouldShowRightIcon={!isReadOnly}

<MenuItemWithTopDescription
key={`${taxRates?.name}${formattedTaxAmount}`}
shouldShowRightIcon={!isReadOnly}

@melvin-bot melvin-bot bot added the Overdue label Apr 22, 2024
@dragnoir
Copy link
Contributor

Proposal

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

Tax currency is editable for employee, and it reverts to default currency after creation

What is the root cause of that problem?

We disable the shouldShowRightIcon here

shouldShowRightIcon={!isReadOnly && !isDistanceRequest}

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

We should do the same for "Tax Amount" here
and return if (isDistanceRequest)

shouldShowRightIcon={!isReadOnly && !isDistanceRequest}

onPress={() => {
  if (isDistanceRequest) {
    return;
  }
  // ...
  }}

POC:

image

Copy link

melvin-bot bot commented Apr 22, 2024

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

@CortneyOfstad CortneyOfstad added the External Added to denote the issue can be worked on by a contributor label Apr 22, 2024
@melvin-bot melvin-bot bot changed the title Tax - Tax currency is editable for employee, and it reverts to default currency after creation [$250] Tax - Tax currency is editable for employee, and it reverts to default currency after creation Apr 22, 2024
Copy link

melvin-bot bot commented Apr 22, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01bf4f1d5c88c460fe

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 22, 2024
Copy link

melvin-bot bot commented Apr 22, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Apr 22, 2024
@CortneyOfstad
Copy link
Contributor

Posted in Wave Collect and will follow up when we have an urgency.

@mananjadhav we have some proposals above for you to review when you have a chance 👍 Thanks!

@trjExpensify trjExpensify changed the title [$250] Tax - Tax currency is editable for employee, and it reverts to default currency after creation [$250] [Track Tax] Tax currency is editable for employee, and it reverts to default currency after creation Apr 22, 2024
@trjExpensify
Copy link
Contributor

@MonilBhavsar discussion about this here for you to catch up on.

@MonilBhavsar
Copy link
Contributor

It will be fixed by #31673

@mananjadhav
Copy link
Collaborator

Should we close this one then?

@trjExpensify
Copy link
Contributor

Maybe, it will be good to point to which PR in that linked issue will fix this because there's a bunch of them, a lot of which are merged.

@melvin-bot melvin-bot bot added the Overdue label Apr 26, 2024
@CortneyOfstad
Copy link
Contributor

@MonilBhavsar to echo TRJ, there are quite a few PRs linked in the GH here — can you point out the PR I should be keeping an eye on as the on-hold for this GH? TIA!

@melvin-bot melvin-bot bot removed the Overdue label Apr 29, 2024
@MonilBhavsar
Copy link
Contributor

It's this one #31673

Copy link

melvin-bot bot commented Apr 29, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@CortneyOfstad CortneyOfstad changed the title [$250] [Track Tax] Tax currency is editable for employee, and it reverts to default currency after creation [ON Hold for #31673] [$250] [Track Tax] Tax currency is editable for employee, and it reverts to default currency after creation May 1, 2024
@melvin-bot melvin-bot bot added the Overdue label May 3, 2024
@CortneyOfstad
Copy link
Contributor

Draft PR is here

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

melvin-bot bot commented May 7, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label May 8, 2024
@CortneyOfstad
Copy link
Contributor

Still waiting on draft PR. Will be delayed due to merge freeze 👍

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

Merge freeze ends on Monday 🎉

@melvin-bot melvin-bot bot added the Overdue label May 13, 2024
@CortneyOfstad
Copy link
Contributor

This is actively being worked on via the on-hold GH, as there was an issue with the distance rates. Discussed here

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

melvin-bot bot commented May 14, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@CortneyOfstad
Copy link
Contributor

Per the comment here, someone else is going to take this on 👍 They are not online now, but will keep an eye on this to get them assigned ASAP.

@melvin-bot melvin-bot bot added the Overdue label May 17, 2024
@mananjadhav
Copy link
Collaborator

@CortneyOfstad Do you need a C+ assigned here?

@melvin-bot melvin-bot bot removed the Overdue label May 19, 2024
@CortneyOfstad
Copy link
Contributor

@mananjadhav — one is automatically assigned via the External label, but I will unassign, as it is not needed at this stage. Thanks!

Copy link

melvin-bot bot commented May 21, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@CortneyOfstad
Copy link
Contributor

PR is here. We're on a merge freeze, so will be a bit before it will be released

@melvin-bot melvin-bot bot added the Overdue label May 24, 2024
Copy link

melvin-bot bot commented May 27, 2024

@CortneyOfstad Huh... This is 4 days overdue. Who can take care of this?

@CortneyOfstad
Copy link
Contributor

Merge freeze extended

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

melvin-bot bot commented May 28, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@trjExpensify
Copy link
Contributor

#42342 has been deployed to staging, taking this off hold.

@trjExpensify
Copy link
Contributor

@MonilBhavsar what are the next steps here?

@trjExpensify trjExpensify changed the title [ON Hold for #31673] [$250] [Track Tax] Tax currency is editable for employee, and it reverts to default currency after creation [$250] [Track Tax] Tax currency is editable for employee, and it reverts to default currency after creation May 29, 2024
@MonilBhavsar
Copy link
Contributor

This is fixed now. We can close it.
User is no longer able to edit tax amount or currency

Screenshot 2024-05-29 at 7 43 13 PM

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
Archived in project
Development

No branches or pull requests

8 participants