Expense - Receipt added after creating expense changes amount & merchant field to scanning
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: V9. 0.71-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both If this was caught during regression testing, add the test name, ID and link from TestRail: N Email or phone of affected tester (no customers): N Issue reported by: Applause Internal Team
Action Performed:
- Launch app
- Go to workspace - new workspace
- Tap category
- Enter gl and payroll code
- Save the category
- Tap settings - toggle on member must categorize all expense
- Tap on workspace chat from workspace settings page
- Create a expense entering big amount and merchant
- Open the expense and upload a receipt using camera
- In few seconds, amount and merchant changed to scanning
- Open amount and merchant field and close
- Note after minutes scanning is shown in amount and merchant field.
- Go back to conversation page
- Open expense again
- Now amount and merchant displayed
Expected Result:
Receipt added after creating expense changes amount & merchant field to scanning must display correct value.
Actual Result:
Receipt added after creating expense changes amount & merchant field to scanning and it resets to correct value only while revisit the page.
Note: scanning text remains and only after revisiting page or refreshing page(mweb) , amount and merchant field displayed again.
Workaround:
Unknown
Platforms:
- [x] Android: Standalone
- [x] Android: HybridApp
- [x] Android: mWeb Chrome
- [ ] iOS: Standalone
- [ ] iOS: HybridApp
- [ ] iOS: mWeb Safari
- [ ] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/18a0a6f8-24bb-4ef1-9410-6f4b563c4e3f
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.
Edited by proposal-police: This proposal was edited at 2024-12-04 23:48:10 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - Receipt added after creating expense changes amount & merchant field to scanning
What is the root cause of that problem?
Whenever the receipt of the transaction is being scanned we are showing scanning for both amount and merchant here
https://github.com/Expensify/App/blob/64829131fe962681626b4b016140521d05f7fe52/src/components/ReportActionItem/MoneyRequestView.tsx#L213-L215
What changes do you think we should make in order to solve the problem?
We should display scanning only if the transaction amount doesn't exist or is zero (or we can also use isScanRequest check to properly determine that the request is scan type whose amount is waiting to be scanned) so we can update it to
if (TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction) && !transactionAmount) {
merchantTitle = translate('iou.receiptStatusTitle');
amountTitle = translate('iou.receiptStatusTitle');
}
We can optionally separate the merchantTitle and only show scanning when transaction merchant is empty (or using the existing condition of isEmptyMerchant) or even show scanning for merchant whenever the receipt is being scanning according to the suggestions of the design team
If needed we can apply similar fixes here and here
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We can test it by rendering (via @testing-library/react-native) the component money request view after populating onyx with all necessary data and mocking to successfully render it, most importantly linked to this issue setting the transaction.receipt.state to scanning and setting the transaction amount and merchant field as needed and assert that the menu for amount and merchant have the correct values (not scanning...). We can assert by getByText to check that a text node with that value exists or we can either giving a testID and checking for the correct values as needed
What alternative solutions did you explore? (Optional)
I haven't' had a chance to review. Will look at this this weekend or first thing Monday morning
I'm fairly certain this is intended behavior. It's returning to the original set Merchant & Amount when the receipt is done scanning. In this case the receipt did not have a merchant or amount.
Although i'm not 100% sure what is expected if the merchant or amount was scanned off the receipt and differed from the manually entered info.
For card expenses, historically we've taken the scanned merchant but not sure if that's the case here 🤔
I'm fairly certain this is intended behavior. It's returning to the original set Merchant & Amount when the receipt is done scanning. In this case the receipt did not have a merchant or amount.
Although i'm not 100% sure what is expected if the merchant or amount was scanned off the receipt and differed from the manually entered info.
For card expenses, historically we've taken the scanned merchant but not sure if that's the case here 🤔
From my observation @OfstadC The manually set amount and merchant are not overrode by scan results here is a demo: the receipt has both amount and merchant but it remained in the manual value set initially.
https://github.com/user-attachments/assets/e98cc68f-3293-4f1a-9d13-99de785d3b14
From my observation @OfstadC The manually set amount and merchant are not overrode by scan results here is a demo: the receipt has both amount and merchant but it remained in the manual value set initially.
Interesting 🤔 .
Asked about this here - https://expensify.slack.com/archives/C06ML6X0W9L/p1734034230368829
@OfstadC Whoops! This issue is 2 days overdue. Let's get this updated quick!
Seems like we do want to fix this. Just waiting to confirm if this is External or Internal
@OfstadC 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!
I believe we do want to scan the receipt (background scan), but it shouldn't be blocking the merchant, amount when completing
Job added to Upwork: https://www.upwork.com/jobs/~021869484444349406830
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-djouah (External)
@OfstadC, @rayane-djouah Eep! 4 days overdue now. Issues have feelings too...
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@OfstadC, @rayane-djouah Still overdue 6 days?! Let's take care of this!
Will get to this one soon
@OfstadC, @rayane-djouah Whoops! This issue is 2 days overdue. Let's get this updated quick!
@OfstadC @rayane-djouah this issue is now 4 weeks old, please consider:
- Finding a contributor to fix the bug
- Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
- If you have any questions, don't hesitate to start a discussion in #expensify-open-source
Thanks!
@OfstadC, @rayane-djouah Huh... This is 4 days overdue. Who can take care of this?
I was OOO and catching up on issues today. I will review the existing proposal today.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
I believe we do want to scan the receipt (background scan), but it shouldn't be blocking the merchant, amount when completing
@OfstadC Is this correct:
BUG:
Amount and merchant fields stay stuck on "scanning" after adding a receipt until navigating away and back.
Action Performed:
- Open your workspace chat.
- Create a manual expense with a specified amount and merchant.
- Open the expense and upload a receipt.
- Observe that after a few seconds, the amount and merchant fields change to "scanning."
- Note that the "scanning" status persists and does not update to the correct values, even after several minutes.
- Navigate back to the conversation page.
- Reopen the expense.
- Observe that the amount and merchant fields now display the correct values instead of "scanning."
Expected Result:
Once the scan is completed, the amount and merchant fields should automatically update and display the correct values without requiring the user to navigate away and return.
Actual Result:
The "scanning" status remains stuck in the amount and merchant fields until the user navigates away and reopens the expense.
So, we want to retain the "Scanning" message but ensure it disappears automatically once the scan is completed?
I don’t think we should display scanning because scanning never affects manually set amount and merchant so why will hide them until the scanning is done which doesn’t even alter them.
On Thu, 2 Jan 2025 at 2:14 AM rayane-djouah @.***> wrote:
So, we want to retain the "Scanning" message but ensure it disappears automatically once the scan is completed?
— Reply to this email directly, view it on GitHub https://github.com/Expensify/App/issues/53535#issuecomment-2567177220, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJG4AZOYHBJM6RJMKVY5IKT2IRZFTAVCNFSM6AAAAABS7XU6SGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRXGE3TOMRSGA . You are receiving this because you commented.Message ID: @.***>
@OfstadC, @rayane-djouah Huh... This is 4 days overdue. Who can take care of this?
scanning never affects manually set amount and merchant
I tested and it seems that it affects manually set amount and merchant:
https://github.com/user-attachments/assets/672be478-e624-4b9b-89f9-906348ab94d2
@rayane-djouah I am observing that the value is updated when smart scanning is done (modifiedAmount and modifiedMerchant) but it will revert to the manual set values on page refresh (both modifiedAmount and modifiedMerchant then get reset)
https://github.com/user-attachments/assets/fc094f4f-390e-4811-8a66-0adea8a52618
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
Issue not reproducible during KI retests. (First week)