[$250] IOU - GBR is missing from the partially approved expense
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.63-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5229984&group_by=cases:section_id&group_id=309128&group_order=asc Issue reported by: Applause - Internal Team
Action Performed:
- All new Gmail accounts are used
- Workspace has an admin, member, and approver
- "Add approvals" is enabled and the approver account is set as the approver
- Member: Navigate to https://staging.new.expensify.com/
- Member: Log in
- Member: Navigate to the workspace chat
- Member: Create two manual expenses with any amounts (amounts should be different)
- Member: Open one of the expenses
- Member: Put the expense on hold
- Approver: Log in
- Approver: Navigate to the workspace chat
- Approver: Click on "Approve"
- Approver: Approve just the pending amount
Expected Result:
Newly created report for the held expense is GBRβed in the LHN (green dot)
Actual Result:
GBR is missing from the partially approved expense
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Standalone
- [ ] Android: HybridApp
- [ ] Android: mWeb Chrome
- [ ] iOS: Standalone
- [ ] iOS: HybridApp
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/3f474518-b1f3-454a-95d9-31f5ffe66435
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021861120032414784544
- Upwork Job ID: 1861120032414784544
- Last Price Increase: 2024-11-25
- Automatic offers:
- DylanDylann | Reviewer | 105123872
- nkdengineer | Contributor | 105123876
Issue Owner
Current Issue Owner: @DylanDylann
Triggered auto assignment to @OfstadC (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.
Not overdue Mel - it was the weekend. Will review this tomorrow AM
@lanitochka17
GBR should be visible
What specifically is missing here
It seems normal to me π€
https://expensify.slack.com/archives/C9YU7BX5M/p1732211583025239
Still reproducible. Actions performed are same, updated the expected result
https://github.com/user-attachments/assets/0a320849-d16d-4448-afc6-af7f90700335
OMG - It was not clear what GBR was to me - April was a saint and helped me!
I actually think this is a dupe of this
Re-reviewing the other issue it seems they are closely related but differ a bit. Adding to #expense
Job added to Upwork: https://www.upwork.com/jobs/~021861120032414784544
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (External)
Edited by proposal-police: This proposal was edited at 2024-11-26 05:05:16 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
GBR is missing from the partially approved expense
What is the root cause of that problem?
If we approve partially, a new expense report will be created with statusNum and stateNum are getting from here
https://github.com/Expensify/App/blob/38568ed1349fc31e53dff2bc64d572d64d4c435f/src/libs/actions/IOU.ts#L6324
If isInstantSubmitEnabled and payment is not disabled, the new expense report is marked as submitted.
https://github.com/Expensify/App/blob/38568ed1349fc31e53dff2bc64d572d64d4c435f/src/libs/ReportUtils.ts#L4646-L4649
But in this case hasOutstandingChildRequest is updated to false here before we get the onyx data of the partially case
https://github.com/Expensify/App/blob/38568ed1349fc31e53dff2bc64d572d64d4c435f/src/libs/actions/IOU.ts#L6990
So no GBR is displayed in LHN
What changes do you think we should make in order to solve the problem?
If we approve in full, we can update hasOutstandingChildRequest like this
https://github.com/Expensify/App/blob/38568ed1349fc31e53dff2bc64d572d64d4c435f/src/libs/actions/IOU.ts#L6990
In this case, it is not full, we need to update hasOutstandingChildRequest of the chat report to true if the new expense report is marked as submitted
https://github.com/Expensify/App/blob/38568ed1349fc31e53dff2bc64d572d64d4c435f/src/libs/actions/IOU.ts#L7077
- We need to move this optimistic data to this case
if (full && hasHeldExpenses) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport?.chatReportID}`,
value: {
hasOutstandingChildRequest: hasIOUToApproveOrPay(chatReport, expenseReport?.reportID ?? '-1'),
},
});
https://github.com/Expensify/App/blob/38568ed1349fc31e53dff2bc64d572d64d4c435f/src/libs/actions/IOU.ts#L6986
- In
getReportFromHoldRequestsOnyxDatafunction, updatehasOutstandingChildRequestof chat report totrueif the new expense report is marked as submitted
hasOutstandingChildRequest: optimisticExpenseReport.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && optimisticExpenseReport.statusNum === CONST.REPORT.STATE_NUM.SUBMITTED,
https://github.com/Expensify/App/blob/38568ed1349fc31e53dff2bc64d572d64d4c435f/src/libs/actions/IOU.ts#L6405
- Require backend change: Backend also needs to update
hasOutstandingChildRequesttotruein this case ofApproveMoneyRequestAPI
What alternative solutions did you explore? (Optional)
@nkdengineer Do we need to require BE change to fix this issue?
It seems the BE return wrong hasOutstandingChildRequest in this case
@DylanDylann you're right, updated proposal.
There are some new updates that block partially approve flow. Just ask to clarify https://github.com/Expensify/App/issues/50479#issuecomment-2499693630
Triggered auto assignment to @NikkiWines, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@NikkiWines Please help to take a look when you have a chance.
@OfstadC @NikkiWines @DylanDylann 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!
Yep, agreed the proposal looks good π
π£ @DylanDylann π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @nkdengineer π 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 π
In this case, it is not full, we need to update hasOutstandingChildRequest of the chat report to true if the new expense report is marked as submitted
@NikkiWines We have a draft PR here. Base on this description, can you please handle the backend change in ApproveMoneyRequest?
Yep, I'll start working on that asap
@OfstadC, @NikkiWines, @DylanDylann, @nkdengineer Whoops! This issue is 2 days overdue. Let's get this updated quick!
Sorry for the delay here, I actually want to just run this by @marcochavezf to confirm intended functionality here.
@marcochavezf I see you in the blame here where we set hasOutstandingChildRequest to false to clear the GBR parent report - how do you feel about updating that to do so only if isFullApproval is true so that in the case of a partial approval the parent report has the GBR added?
Not overdue
how do you feel about updating that to do so only if isFullApproval is true so that in the case of a partial approval the parent report has the GBR added?
Oh sound good, the hasOutstandingChildRequest set to false was implemented before we had partial approvements, so yeah it makes sense to check if is full approval is true for this case
Backend PR is up