Repository navigation
[HOLD for payment 2024-07-23][$250] We're requiring merchants when sending an invoice, when we shouldn't be. #44126
Description
Activity
Proposal
Please re-state the problem that we are trying to solve in this issue.
Merchant is required for invoice request even though it shouldn't.
What is the root cause of that problem?
This happens after this PR where we change it so the merchant is required when creating or editing the invoice.
const isMerchantRequired = (isPolicyExpenseChat || isTypeInvoice) && (!isScanRequest || isEditingSplitBill) && shouldShowMerchant;
const isMerchantRequired = ReportUtils.isReportInGroupPolicy(report) || isTypeInvoice || transaction?.participants?.some((participant) => !!participant.isPolicyExpenseChat); Previously, the invoice was only required in edit invoice detail, but the PR above makes it consistent so creating an invoice also requires a merchant.
What changes do you think we should make in order to solve the problem?
Because we do not want to make it required, we need to "revert" that PR. We will remove the invoice type condition from both of these codes
const isMerchantRequired = (isPolicyExpenseChat || isTypeInvoice) && (!isScanRequest || isEditingSplitBill) && shouldShowMerchant;
const isMerchantRequired = ReportUtils.isReportInGroupPolicy(report) || isTypeInvoice || transaction?.participants?.some((participant) => !!participant.isPolicyExpenseChat); isPolicyExpenseChatis false for invoice, however,ReportUtils.isReportInGroupPolicyis true even for invoice because it's part of a policy.To fix it, we have 2 options:
-
Replace
isReportInGroupPolicywithisExpenseRequest. This condition is stricter by checking whether the request is an expense request or not which is true for workspace expense requests, but not for invoice or IOU request. -
Add
!ReportUtils.isInvoiceRequest(report) &&condition so it only could be true if it's not an invoice request.
const isMerchantRequired = !ReportUtils.isInvoiceRequest(report) && (ReportUtils.isReportInGroupPolicy(report) || transaction?.participants?.some((participant) => !!participant.isPolicyExpenseChat));isInvoiceRequestwill be a new function that is similar toisExpenseRequestfunction isInvoiceRequest(report: OnyxInputOrEntry<Report>): boolean { if (isThread(report)) { const parentReportAction = ReportActionsUtils.getParentReportAction(report); const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`]; return isInvoiceReport(parentReport) && !isEmptyObject(parentReportAction) && ReportActionsUtils.isTransactionThread(parentReportAction); } return false; }-
Damn, it looks like the other PR linked was created to make it so that a merchant name is required on invoices. Unfortunately the invoicing project team didn't catch it because it never passed through the project Slack channel or the project board.
That proposal looks good @bernhardoj
- addedExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributorBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.
on Jun 21, 2024 Job added to Upwork: https://www.upwork.com/jobs/~010f4b3b019ed717d4
- changed the title
[-]We're requiring merchants when sending an invoice, when we shouldn't be. [/-][+][$250] We're requiring merchants when sending an invoice, when we shouldn't be. [/+]on Jun 21, 2024 - addedHelp WantedApply this label when an issue is open to proposals by contributorsApply this label when an issue is open to proposals by contributors
on Jun 21, 2024 Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-djouah (
External)Triggered auto assignment to @miljakljajic (
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.@bernhardoj's proposal looks good to me
🎀👀🎀 C+ reviewed
18 remaining items
PR is ready
cc: @rayane-djouah
What will the payment date for this one be?
It's deployed to prod 3 days ago, so it should be 23 July
- addedAwaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionand removedReviewingHas a PR in reviewHas a PR in review
on Jul 19, 2024 - changed the title
[-][$250] We're requiring merchants when sending an invoice, when we shouldn't be. [/-][+][HOLD for payment 2024-07-23][$250] We're requiring merchants when sending an invoice, when we shouldn't be. [/+]on Jul 19, 2024 Not overdue
Both contributors paid!
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
If you go to Send Invoice, and then input a user, we're requiring a merchant name. We should not be requiring the merchant. This is reproducable on all platforms for me.
cc @davidcardoza @cristipaval
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @miljakljajic