-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 rate does not update when editing distance rate offline #48293
Comments
Triggered auto assignment to @bfitzexpensify ( |
@bfitzexpensify 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-30 00:03:36 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Track tax - Tax rate does not update when editing distance rate offline What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
Code changes function selectDistanceRate(customUnitRateID: string) {
let taxAmount;
let taxRateExternalID;
if (shouldShowTax) {
const policyCustomUnitRate = getCustomUnitRate(policy, customUnitRateID);
taxRateExternalID = policyCustomUnitRate?.attributes?.taxRateExternalID ?? '-1';
const taxableAmount = DistanceRequestUtils.getTaxableAmount(policy, customUnitRateID, TransactionUtils.getDistanceInMeters(transaction, unit));
const taxPercentage = TransactionUtils.getTaxValue(policy, transaction, taxRateExternalID) ?? '';
taxAmount = CurrencyUtils.convertToBackendAmount(TransactionUtils.calculateTaxAmount(taxPercentage, taxableAmount, rates[customUnitRateID].currency ?? CONST.CURRENCY.USD));
IOU.setMoneyRequestTaxAmount(transactionID, taxAmount);
IOU.setMoneyRequestTaxRate(transactionID, taxRateExternalID);
}
if (currentRateID !== customUnitRateID) {
IOU.setMoneyRequestDistanceRate(transactionID, customUnitRateID, policy?.id ?? '-1', !isEditing);
if (isEditing) {
IOU.updateMoneyRequestDistanceRate(
transaction?.transactionID ?? '-1',
reportID,
customUnitRateID,
policy,
policyTags,
policyCategories,
shouldShowTax ? taxRateExternalID : transaction?.taxCode,
shouldShowTax ? taxAmount : transaction?.taxAmount,
);
}
}
navigateBack();
}
function updateMoneyRequestDistanceRate(
transactionID: string,
transactionThreadReportID: string,
rateID: string,
policy: OnyxEntry<OnyxTypes.Policy>,
policyTagList: OnyxEntry<OnyxTypes.PolicyTagLists>,
policyCategories: OnyxEntry<OnyxTypes.PolicyCategories>,
taxCode?: string,
taxAmount?: number,
) {
const transactionChanges: TransactionChanges = {
customUnitRateID: rateID,
...(taxCode ? {taxCode} : {}),
...(taxAmount ? {taxAmount} : {}),
};
// ...
} What alternative solutions did you explore? (Optional)We can do few things here:
<OfflineWithFeedback pendingAction={isDistanceRequest ? getPendingFieldAction('taxCode') ?? getPendingFieldAction('customUnitRateID') : getPendingFieldAction('taxCode')}> App/src/components/ReportActionItem/MoneyRequestView.tsx Lines 620 to 651 in 8c0386a
Result |
Proposal Updated
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Tax rate does not update after changing distance rate offline in transaction thread. The only thing that updates is the removal of "default" label in tax rate field What is the root cause of that problem?
App/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx Lines 88 to 97 in 489312e
When we're in the edit flow, we don't update the tax rate and tax amount in optimistic data in
Tax rate/tax amount is only grayed out if we have pending action on tax rate/tax amount
What changes do you think we should make in order to solve the problem?
For this bug, we can follow the same way we do in
App/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx Lines 88 to 97 in 489312e
and use this in
For this bug, we can check if the request is distance request we will add the fallback pending action for tax rate and tax amount with the pending action of distance rate here
<OfflineWithFeedback pendingAction={isDistanceRequest ? getPendingFieldAction('taxAmount') ?? getPendingFieldAction('customUnitRateID') : getPendingFieldAction('taxAmount')}>
What alternative solutions did you explore? (Optional)NA |
Proposal Updated
|
@bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Job added to Upwork: https://www.upwork.com/jobs/~01c25cfebc45c34fc3 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif ( |
Thanks for the proposals. Can you please share demo videos after applying your solution? |
tax_rate_amount_offline.mp4 |
@aimane-chnaif The result here. Screen.Recording.2024-09-05.at.10.59.36.mov |
I am heading out of office until September 21st, so assigning a buddy to watch over this in my absence. Current status: working through proposals |
Triggered auto assignment to @lschurr ( |
@lschurr, @bfitzexpensify, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick! |
@aimane-chnaif what do you think of these proposals? CC: @MonilBhavsar for eyes. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@Krishna2323's main solution looks good. |
Triggered auto assignment to @marcaaron, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
📣 @Krishna2323 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@marcaaron @lschurr @bfitzexpensify @Krishna2323 @aimane-chnaif this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
@aimane-chnaif, PR ready for review ^ |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
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.26-2
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/4902670
Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com
**Issue reported by:**Applause - Internal Team
Action Performed:
Precondition:
Expected Result:
Actual Result:
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6586512_1724933599343.20240829_200404.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @aimane-chnaifThe text was updated successfully, but these errors were encountered: