Open IuliiaHerets opened 2 hours ago
Triggered auto assignment to @JmillsExpensify (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.
@JmillsExpensify 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
In search, Invoice doesn't displays merchant text "expense".
Sometime when we create a send invoice, merchant
param is an empty string then BE returns merchant
as Expense
.
I think the current problem here is the Expense
merchant appears in REPORTPREVIEW
action. That is how we're displaying merchant in other places like here, here and here
We should fix to not display Expense
merchant in the report preview action. To do that we can add the same check that we use to display the merchant in other places
const shouldShowMerchant =
!!formattedMerchant &&
formattedMerchant !== CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT &&
formattedMerchant !== CONST.TRANSACTION.DEFAULT_MERCHANT &&
!(hasOnlyTransactionsWithPendingRoutes && !totalDisplaySpend);
const shouldShowSingleRequestMerchantOrDescription =
numberOfRequests === 1 && (!!shouldShowMerchant || !!formattedDescription) && !(hasOnlyTransactionsWithPendingRoutes && !totalDisplaySpend);
When we create a send invoice, we can fallback merchant as CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT
here
Invoice - In search, Invoice doesn't displays merchant text "expense"
Right here if the merchant value is equal to Expense
we return empty string
https://github.com/Expensify/App/blob/e9de4f2b1d5d1ed8b1ab705cd1fb79dee42a95a5/src/libs/SearchUtils.ts#L85
merchant === CONST.TRANSACTION.DEFAULT_MERCHANT ? ''
We should remove this code: merchant === CONST.TRANSACTION.DEFAULT_MERCHANT ? ''
Invoice - In search, Invoice doesn't displays merchant text "expense"
We don't display the merchant if the merchant is 'Expense' https://github.com/Expensify/App/blob/a59bbc3cf846c718ba40f0919fabb371c6dcd86d/src/libs/SearchUtils.ts#L85
If we need to display the merchant although it is Expense
for Invoices we can update the following code
https://github.com/Expensify/App/blob/a59bbc3cf846c718ba40f0919fabb371c6dcd86d/src/libs/SearchUtils.ts#L85
const formattedMerchant = merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || (merchant === CONST.TRANSACTION.DEFAULT_MERCHANT && transactionItem.reportType != CONST.REPORT.TYPE.INVOICE) ? '' : merchant;
And update this to show the merchant column https://github.com/Expensify/App/blob/a59bbc3cf846c718ba40f0919fabb371c6dcd86d/src/libs/SearchUtils.ts#L119
return merchant !== '' && merchant !== CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT && !(merchant === CONST.TRANSACTION.DEFAULT_MERCHANT && item.reportType != CONST.REPORT.TYPE.INVOICE);
ALTERNATIVE 1 If we want to always display the merchant for all reportType change to the following
const formattedMerchant = merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT ? '' : merchant;
return merchant !== '' && merchant !== CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;
ALTERNATIVE 2 Also the merchant set to Expense because the merchant param we pass to the API is empty string, if we want to set it to empty or (none) can can update the following code https://github.com/Expensify/App/blob/a59bbc3cf846c718ba40f0919fabb371c6dcd86d/src/libs/actions/IOU.ts#L3678
merchant: transaction?.merchant ?? CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT,
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.49-0 Reproducible in staging?: Y Reproducible in production?: Y Issue reported by: Applause Internal Team
Action Performed:
Pre-condition:Keep invoice enabled in a workspace
Go to https://staging.new.expensify.com/home
Tap fab--send invoice
Create an invoice
Navigate to LHN -- Search
Navigate to invoice section
Note preview doesn't show merchant field text "expense"
Tap on the invoice and note "expense" text in merchant field
Expected Result:
In search, Invoice must display merchant text "expense".
Actual Result:
In search, Invoice doesn't displays merchant text "expense".
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/8c1f7073-8c38-46a2-9c62-8a3b702cb52b
View all open jobs on GitHub