Open IuliiaHerets opened 2 weeks ago
Triggered auto assignment to @strepanier03 (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.
We think that this bug might be related to #wave-control
@strepanier03 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
The Tax field for the expense does not update, unless user switches to another tab and back to Expenses tab.
We use updateMoneyRequestDistanceRate
here to update tax rate. This function gets optimistic data for transaction when updating using getUpdateMoneyRequestParams
here.
This function calculates updated data using TransactionUtils.getUpdatedTransaction
here.
However, when we update the tax rate, there are only customUnitRateID
in transactionChanges
:
So, in TransactionUtils.getUpdatedTransaction
, only customUnitRateID
will be updated
Add a function to calculate tax amount using custom rateID
, transactionID
:
function getTaxAmountOfTransaction(policy: OnyxEntry<Policy>, customUnitRateID: string, transactionID: string) {
const distanceUnit = PolicyUtils.getCustomUnit(policy);
const customUnitRate = PolicyUtils.getCustomUnitRate(policy, customUnitRateID);
if (!distanceUnit || !distanceUnit?.customUnitID || !customUnitRate) {
return 0;
}
const transaction = TransactionUtils.getTransaction(transactionID);
const unit = distanceUnit?.attributes?.unit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES;
const distance = TransactionUtils.getDistanceInMeters(transaction, unit);
const rate = customUnitRate?.rate ?? 0;
const amount = getDistanceRequestAmount(distance, unit, rate);
const taxClaimablePercentage = customUnitRate.attributes?.taxClaimablePercentage ?? 0;
const taxPercentage = TransactionUtils.getTaxValue(policy, transaction, customUnitRate?.attributes?.taxRateExternalID ?? '') ?? '';
return CurrencyUtils.convertToBackendAmount(TransactionUtils.calculateTaxAmount(taxPercentage, amount * taxClaimablePercentage, customUnitRate.currency ?? CONST.CURRENCY.USD));
}
Then add taxAmount
to transactionChanges
here:
const transactionChanges: TransactionChanges = {
customUnitRateID: rateID,
taxAmount: getTaxAmountOfTransaction(policy, rateID, transactionID)
};
This is a BE issue as we don't support optimistic data for Search.
@strepanier03 Huh... This is 4 days overdue. Who can take care of this?
Hmmm, I'm not able to reproduce this as described. During my testing the tax field was updating after making a change and closing the RHP, I didn't need to toggle to another tab to get it to update.
I'm also receiving some inconsistent behavior as sometimes I'm unable to change the tax rate on the expense. I'm going to test this some more.
@strepanier03 Huh... This is 4 days overdue. Who can take care of this?
Okay, got past the inconsistent behavior I was running into and was able to reproduce this successfully.
@strepanier03 this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@strepanier03 Whoops! This issue is 2 days overdue. Let's get this updated quick!
No update yet. Tied to a project and labeled.
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: v9.0.25-2 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com Issue reported by: Applause Internal Team
Action Performed:
Precondition:
Expected Result:
The Tax field for the expense will update.
Actual Result:
The Tax field for the expense does not update, unless user switches to another tab and back to Expenses tab.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/3ff338c0-f658-481d-a751-2247ae3f9451
View all open jobs on GitHub