Closed lanitochka17 closed 2 months ago
Triggered auto assignment to @isabelastisser (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.
@isabelastisser 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
Edited by proposal-police: This proposal was edited at 2024-08-02 19:45:41 UTC.
Different tax rate on confirmation page & transaction thread when tax rate is disabled
We are displaying the foreign default if the policy currency and transaction currency are not the same without check if the foreign default is not disabled in the first place https://github.com/Expensify/App/blob/8abdcca86923a5a121734f34bbc53f2eeb5a45dd/src/libs/TransactionUtils.ts#L760-L768 But the BE checks that it is disabled and it will default it to the default tax
We need to check if the foreign tax is disabled and if it is we should set it to defaultExternalID
const defaultExternalID = policy?.taxRates?.defaultExternalID;
const foreignTaxDefault = policy?.taxRates?.foreignTaxDefault;
const taxes = policy?.taxRates?.taxes;
const isForeignDefaultDisabled = taxes?.[foreignTaxDefault ?? '']?.isDisabled;
return policy?.outputCurrency === (currency ?? getCurrency(transaction)) || isForeignDefaultDisabled ? defaultExternalID : foreignTaxDefault;
}
Although this bug is related to getDefaultTaxCode
called inside getTaxName here the function is used in a lot of places so we can make this logic of checking if the foreign default is disabled for all usages of the function or we can create a param and only use it in selected places we need them.
By the way in the case of submit expense the disabled foreign default tax is set to the expense with violation indicating the tax is no longer valid so the changes suggested above might need only be applied for split expense not submit ones. so we only apply the check if iouType
is split when we get the tax name here
Tax - Different tax rate on confirmation page & transaction thread when tax rate is disabled
Foreign currency default
and disabled tax is returned from getDefaultTaxCode
.
https://github.com/Expensify/App/blob/459759d55963091c708d7271c29e0f95f3add658/src/libs/PolicyUtils.ts#L414-L419
https://github.com/Expensify/App/blob/459759d55963091c708d7271c29e0f95f3add658/src/libs/TransactionUtils/index.ts#L757-L766
We should update canEditTaxRate
to return false when tax is defaultExternalID
or foreignTaxDefault
.
function canEditTaxRate(policy: Policy, taxID: string): boolean {
return policy.taxRates?.defaultExternalID !== taxID && policy.taxRates?.foreignTaxDefault !== taxID;
}
https://github.com/user-attachments/assets/2a6d12a6-b63b-49c7-9432-3dd2e98ea0c5
Job added to Upwork: https://www.upwork.com/jobs/~012b83b7675405b2d3
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External
)
@eVoloshchak, @isabelastisser Whoops! This issue is 2 days overdue. Let's get this updated quick!
@eVoloshchak can you please review the proposals? Thanks!
CC: @luacmartins @MonilBhavsar for vis!
@MonilBhavsar would you be able to take a look at this since you're more familiar with the tax udf?
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@eVoloshchak, @isabelastisser 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
This was already resolved by https://github.com/Expensify/App/pull/46862, @FitseTLT, @Krishna2323, could you please double-check if this is still reproducible for you?
@eVoloshchak, not reproducible anymore. @isabelastisser we can close this.
Closing as per the comments above.
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.0.16-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: https://expensify.testrail.io/index.php?/tests/view/4808605 Issue reported by: Applause - Internal Team
Action Performed:
Precondition:
Expected Result:
In Step 8. the tax rate on confirmation page when foreign currency is used should be consistent with the tax rate on split preview and transaction thread (Step 11)
Actual Result:
In Step 8. the tax rate on confirmation page when foreign currency shows the tax rate for Foreign currency default even though it is already disabled In Step 11, after splitting the expense, the tax rate changes to Workspace currency default which is not consistent with the rate shown on the confirmation page before splitting
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/52705480-0019-498c-87da-54864ce51376
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @eVoloshchak