[$175] [Exploratory] Invoice - Billable toggle auto-off after creating the invoice
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: v9.5.26-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/81348517/folder/57600901/41237194/1926749759?sort=%2Bidentifier Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Windows 11/Chrome App Component: Chat Report View
Action Performed:
Preconditions: Tester has already set up the Control Workspace to be tested in NewDot Enable Rules and Set Billable default to "Billable", turn on Invoice Steps:
- Open the NewDot app
- Click on FAB - Send Invoice
- Select a user - Create the invoice
- Click on the View button on Growl
Expected Result:
The Billable toggle is enabled
Actual Result:
On the confirmation page, the Billable toggle is on, but after creating and reopening, it turns off
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [x] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/c6931a9c-931a-482f-bafe-d14c05e3d536
Applause Internal Information Exported by: Rizky Gunawan Bug ID: 7300203
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022117413166776386492
- Upwork Job ID: 2117413166776386492
- Last Price Increase: 2026-11-03
Issue Owner
Current Issue Owner: @roryabraham
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/0fda652d849fe8d3a49b3eafb01f48e5169f47883795194a82db51c84a7b728b
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0105ac9050d5ca10e5
Proposal
Please re-state the problem that we are trying to solve in this issue.
When sending an invoice from a workspace that has Rules enabled and the default set to "Billable", the Billable toggle displays as enabled on the confirmation screen, but after creating the invoice and reopening it, the Billable toggle reverts to disabled (off).
What is the root cause of that problem?
In src/libs/actions/IOU/SendInvoice.ts:
- In
sendInvoice()(lines 855–878), theparameterspayload constructed forAPI.writeWhenReady(WRITE_COMMANDS.SEND_INVOICE, parameters, ...)fails to forwardbillable: transaction?.billable(and insrc/libs/API/parameters/SendInvoiceParams.ts, thebillable?: booleanproperty is omitted from theSendInvoiceParamstype definition). - While
getSendInvoiceInformation()correctly assignsbillableto the optimistic transaction object (line 706), the backendSendInvoicecommand never receives thebillableparameter. When the backend executes and persists the transaction and syncs back down to Onyx, the transaction'sbillablestate is reset back to false.
What changes do you think we should make in order to solve the problem?
- In
src/libs/API/parameters/SendInvoiceParams.ts:- Add
billable?: booleanto theSendInvoiceParamstype definition.
- Add
- In
src/libs/actions/IOU/SendInvoice.ts:- In
sendInvoice(), passbillable: transaction?.billableinsideparametersalongsideamount,comment,category, and other transaction fields so that the backendSendInvoicecommand persists the billable status selected on the invoice.
- In
What alternative solutions did you explore? (Optional)
None needed. Forwarding billable in SendInvoiceParams matches the standard pattern used across all other IOU transaction flows (e.g., MoneyRequest, TrackExpense, PerDiem).
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
What is the root cause of that problem?
The SendInvoice request never sends billable to the server.
- On the confirmation page, the draft transaction gets
billablefrom the workspace default. So the toggle shows on. sendInvoice()copiesbillableonto the optimistic transaction (SendInvoice.ts:706).- The API parameters leave
billableout (SendInvoice.ts:849-871). TheSendInvoiceParamstype has nobillablefield either (SendInvoiceParams.ts:3-29). - The server saves the invoice as not billable. Its copy replaces the optimistic transaction, so the toggle in
MoneyRequestViewshows off.
What changes do you think we should make in order to solve the problem?
- Add an optional
billablefield toSendInvoiceParams, likeRequestMoneyParamsandTrackExpenseParamsdo. - In
sendInvoice(), sendtransaction?.billablein theSEND_INVOICEparameters, next tocategory.
Both callers pass the full draft transaction, so this one change covers both.
Backend check needed: I could not confirm that the backend SendInvoice command reads a billable parameter. If it doesn't, an internal engineer must add that before the App change takes effect.
What alternative solutions did you explore? (Optional)
None. Note that tag, taxCode, and taxAmount have the same gap: they go on the optimistic transaction but not in the request. Fix those in the same PR if invoices should keep them.
Code references
- Workspace default applied to the draft:
ExpenseDefaultsSetter.tsx:24-33 - Draft transaction passed to
sendInvoice:useInvoiceSubmission.ts:73-91andDynamicIOURequestStepCompanyInfo.tsx:110-113 - Pattern to follow:
RequestMoneyParams.ts:27 - Toggle after creation reads
transaction.billable:MoneyRequestView.tsx:1826 - The invoice success and failure data don't touch
billable, so the client doesn't reset it. The off value comes from the server.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/105460) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (External)
Job added to Upwork: https://www.upwork.com/jobs/~022117413166776386492
@expensify/product Is billable toggle for invoices intentional? I am curious if we need to hide billable toggle for invoices since invoice is only a document to collect payment.
What do you think?
Is billable toggle for invoices intentional? I am curious if we need to hide billable toggle for invoices since invoice is only a document to collect payment. Note that tag, taxCode, and taxAmount have the same gap: they go on the optimistic transaction but not in the request. Fix those in the same PR if invoices should keep them.
@heyjennahay could you confirm the expected results on all three of these? @rojiphil you could also check an invoice in Classic in the meantime.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating an invoice from the confirmation page with the "Billable" toggle enabled, opening the newly created invoice details shows the "Billable" toggle turned on momentarily (optimistically) and then automatically flipping off once the SendInvoice network request finishes.
What is the root cause of that problem?
In src/libs/actions/IOU/SendInvoice.ts:
getSendInvoiceInformation()builds the optimistic transaction withbillablepreserved from the draft transaction, so the UI initially displays"Billable"as enabled.- However, in
sendInvoice()(src/libs/actions/IOU/SendInvoice.ts, lines 855–878), theparametersobject constructed forAPI.write(WRITE_COMMANDS.SEND_INVOICE, parameters, onyxData)omitsbillable: transaction?.billable(andsrc/libs/API/parameters/SendInvoiceParams.tsdoes not declarebillable?: boolean). Becausebillableis never sent to the backend inSendInvoice, the server creates the invoice transaction withbillable: falseand returns that in the response Onyx updates, overwriting the optimisticbillable: truestate.
What changes do you think we should make in order to solve the problem?
- In
src/libs/API/parameters/SendInvoiceParams.ts, addbillable?: boolean;toSendInvoiceParams. - In
src/libs/actions/IOU/SendInvoice.ts(around lines 855–878), includebillable: transaction?.billablein theparametersobject passed toAPI.write(WRITE_COMMANDS.SEND_INVOICE, parameters, onyxData). - Update
tests/actions/IOUTest.tsto assert thatSendInvoicepassesbillablein the API write parameters when creating an invoice.
What alternative solutions did you explore? (Optional)
None—passing billable in the SendInvoice API parameters directly aligns sendInvoice() with requestMoney() and trackExpense(), both of which already pass billable in their respective API parameters.
📣 @jeffrey-graham! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating an invoice on a workspace that has tags/categories and a default billable setting enabled (so the Billable toggle is ON on the confirmation page), after clicking Send invoice and opening the newly created invoice's transaction details, the Billable toggle automatically turns OFF.
What is the root cause of that problem?
In src/libs/actions/IOU/SendInvoice.ts (getSendInvoiceInformation and sendInvoice, lines 622–875):
getSendInvoiceInformation(line 706) passesbillableintobuildOptimisticTransaction, sooptimisticTransaction.billableistruewhile the request is in flight (which is why the Billable toggle initially appears ON right after creation).- However, in
sendInvoice(src/libs/actions/IOU/SendInvoice.tslines 849–870) andSendInvoiceParams(src/libs/API/parameters/SendInvoiceParams.ts), theparametersobject sent toAPI.write(WRITE_COMMANDS.SEND_INVOICE, parameters, onyxData)omitsbillable: transaction?.billable(unlikerequestMoneyandtrackExpense, which explicitly includebillablein their API parameters). - Because
billableis never sent in theSendInvoiceAPI payload, the backend creates the invoice transaction withbillable: falseand returns that transaction in the response/Pusher update, overwriting the optimisticbillable: truevalue and flipping the Billable switch to OFF.
What changes do you think we should make in order to solve the problem?
- Add
billable?: booleantoSendInvoiceParamsinsrc/libs/API/parameters/SendInvoiceParams.ts. - Include
billable: transaction?.billableinparametersinsidesendInvoice(src/libs/actions/IOU/SendInvoice.tslines 849–870):- Pass
billable: transaction?.billablein theSendInvoiceParamspayload so the backend persists the billable flag selected on the confirmation step and returnsbillable: truein the server response.
- Pass
What alternative solutions did you explore? (Optional)
Preserving billable client-side by ignoring the server response was considered and rejected because the server is the source of truth for invoice transaction fields and other devices/receivers rely on the persisted backend billable property.
@rojiphil Eep! 4 days overdue now. Issues have feelings too...
@rojiphil 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
@rojiphil 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!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating an invoice from a Control workspace with Rules enabled and Default billable set to Billable, the confirmation screen (InvoiceConfirmationList) shows the Billable toggle enabled (on), and right after sending the invoice it initially renders enabled optimistically—but as soon as the SendInvoice request resolves (or on reopen), the Billable toggle turns off (even though MoneyRequestView continues to render and allow toggling Billable on that invoice via UpdateMoneyRequestBillable).
What is the root cause of that problem?
-
SendInvoicebuilds the optimistic transaction withbillable,tag,taxCode, andtaxAmount, yet omits them from theSendInvoiceAPI payload:- On the confirmation step (
IOURequestStepConfirmation/index.tsx:711-717),ExpenseDefaultsSetter(src/pages/iou/request/step/confirmation/ExpenseDefaultsSetter.tsx:24-33) seedstransaction.billable = !!policy?.defaultBillableonto the draft transaction, anduseFooterDerivedFlags(src/components/MoneyRequestConfirmationListFooter/hooks/useFooterDerivedFlags.ts:94) setsshouldShowBillable = isBillableEnabledOnPolicy(policy)(while explicitly hiding Reimbursable via!isTypeInvoiceat line100). - When the user submits via
useInvoiceSubmission.ts:73-91(orDynamicIOURequestStepCompanyInfo.tsx:110-128),getSendInvoiceInformation(src/libs/actions/IOU/SendInvoice.ts:641-655, 692-709) readsbillable(along withtag,taxCode, andtaxAmount) from the draft transaction and writes them ontooptimisticTransactionin Onyx (lines 196-199). - However,
sendInvoice(src/libs/actions/IOU/SendInvoice.ts:849-871) andsrc/libs/API/parameters/SendInvoiceParams.ts:3-29only sendamount,currency,comment,merchant,category,date, anddescription—omittingbillable(andtag,taxCode,taxAmount). Because the backendSendInvoicecommand never receivesbillable, the persisted server transaction comes back withbillable: falseand overwrites the optimistic Onyx transaction.
- On the confirmation step (
-
Codebase verification on how NewDot treats
billable,tag, andtaxCode/taxAmounton Invoices (addressing@rojiphil&@trjExpensify's question in #issuecomment-6655297431): Tracing both the creation (InvoiceConfirmationList) and detail/edit (MoneyRequestView) surfaces shows an existing asymmetry across those three field groups:billableIS surfaced and editable on created invoices inMoneyRequestView: Insrc/components/ReportActionItem/MoneyRequestView.tsx:314-315, 562, 1770-1810,isPolicyExpenseChatisisGroupPolicyByType(reportPolicyType)(truefor the sender's Control workspace). Notice line568(shouldShowReimbursable) and line601(shouldShowVendor) explicitly exclude!isInvoice, whereasshouldShowBillable(line 562) does not excludeisInvoice—and toggling it inMoneyRequestViewcallsupdateMoneyRequestBillable(UpdateMoneyRequest.ts), which persistsbillableon the invoice transaction! (Conversely, if Product decides invoices should not carrybillable, hiding it requires guarding three places—not just confirmation—otherwiseExpenseDefaultsSetterstill stampsbillable: trueandMoneyRequestViewstill renders the toggle wheneverisBillableEnabledOnPolicy(policy)is true; see Alternative below.)tagandtaxCode/taxAmountare ALREADY hidden during invoice creation, yetMoneyRequestViewleaks them post-creation andFieldAutoSelectormutatestagsilently:- On
IOURequestStepConfirmation/index.tsx:348-370,isPolicyExpenseChatisfalseforiouType === CONST.IOU.TYPE.INVOICE(an invoice's participants are{accountID}+{policyID, isSender: true}, and the room haschatType: 'invoice', not'policyExpenseChat'). Therefore onInvoiceConfirmationList:shouldShowTags(useFooterDerivedFlags.ts:83:(isPolicyExpenseChat || isUnreported || isCreatingTrackExpense) && hasEnabledTags(policyTagLists)) is alreadyfalse.shouldShowTax(useConfirmationListData.ts:128:isTaxTrackingEnabled(isPolicyExpenseChat || isTrackExpense, policy, ...)) is alreadyfalse, soTaxController.tsx:83, 100(if (!shouldShowTax) return;) never populatestaxCode/taxAmounton invoice creation.
- Hidden bug in
FieldAutoSelector.tsx:84-103: Even thoughshouldShowTagsisfalseonInvoiceConfirmationList,InvoiceConfirmationList.tsx:22mounts<FieldAutoSelector {...data.fieldAutoSelectProps} />, whose seconduseEffect(FieldAutoSelector.tsx:84-103) does not checkshouldShowTags(unlike the categoryuseEffectabove it, which checksshouldShowCategoriesat line73)! When the sender workspace has a required tag list with a single enabled tag,FieldAutoSelectorsilently writestagonto the draft invoice transaction even though Tags are hidden on the invoice confirmation form. - And once the invoice is created,
MoneyRequestView.tsx:315setsisPolicyExpenseChat = isGroupPolicyByType(reportPolicyType)(true!), which causes Category, Tag, Tax, and Billable to appear on the sent invoice detail view even when Tag/Tax were hidden during creation.
- On
What changes do you think we should make in order to solve the problem?
Depending on Product's confirmation (@heyjennahay / @trjExpensify), here is the exact, complete fix for either direction:
Path A — Keep billable (and optionally tag / taxCode / taxAmount) working end-to-end on Invoices (matches current InvoiceConfirmationList + MoneyRequestView behavior and the QA test expectation):
src/libs/API/parameters/SendInvoiceParams.ts: Addbillable?: boolean;(andtag?: string; taxCode?: string; taxAmount?: number;if backendSendInvoicesupports them alongsideRequestMoneyParams.ts:24-27):category?: string; tag?: string; taxCode?: string; taxAmount?: number; billable?: boolean;src/libs/actions/IOU/SendInvoice.ts: Return the resolvedtaxCode(or readoptimisticTransactionfields) fromgetSendInvoiceInformationand forwardbillable: transaction?.billable(plustag: transaction?.tag,taxCode,taxAmount: transaction?.taxAmountif supported by Auth/Web-ESendInvoice) inparameterspassed toAPI.writeWhenReady(WRITE_COMMANDS.SEND_INVOICE, parameters, ...).src/components/MoneyRequestConfirmationList/FieldAutoSelector.tsx:84: PassshouldShowTagsintoFieldAutoSelectorand guard the tag auto-selection effect (if (!transactionID || !shouldShowTags) { return; }), matchingshouldShowCategoriesat line73, so hidden tag fields are never silently populated on flows whereshouldShowTagsisfalse.- Tests (
tests/actions/IOUTest/SendInvoiceTest.ts): Assert thatsendInvoiceforwardsbillable: true(andbillable: false) in theWRITE_COMMANDS.SEND_INVOICEAPI parameters and preservesoptimisticTransaction.billable. (Note: If Web-E/AuthSendInvoicedoes not yet persistbillableonto the created invoice transaction, an internal backend update is also needed so the server response echoesbillable.)
What alternative solutions did you explore? (Optional)
- Path B — If Product confirms Invoices should NOT have
billable(nortag/tax) at all (@rojiphil's hypothesis): Simply hiding the switch in one component is insufficient because three separate layers touchbillableon invoices. All four places below must be gated with!isTypeInvoice/!isInvoice:useFooterDerivedFlags.ts:94:const shouldShowBillable = isBillableEnabledOnPolicy(policy) && !isTypeInvoice;(hides Billable onInvoiceConfirmationList).ExpenseDefaultsSetter.tsx:27(called fromIOURequestStepConfirmation/index.tsx:711): skipsetMoneyRequestBillable(transactionID, defaultBillable)wheniouType === CONST.IOU.TYPE.INVOICEso draft invoices never inheritpolicy.defaultBillable = true.MoneyRequestView.tsx:562(and:556,:633iftagandtaxshould also be excluded from sent invoices, matchingInvoiceConfirmationList): add&& !isInvoicetoshouldShowBillable(matchingshouldShowReimbursableat line568andshouldShowVendorat line601) soMoneyRequestViewdoes not display the Billable toggle on opened invoices.FieldAutoSelector.tsx:84: guard tag auto-selection withshouldShowTags.
@rojiphil 12 days overdue. Walking. Toward. The. Light...
@rojiphil please review these.
This issue has not been updated in over 14 days. @rojiphil eroding to Weekly issue.
Is billable toggle for invoices intentional? I am curious if we need to hide billable toggle for invoices since invoice is only a document to collect payment. Note that tag, taxCode, and taxAmount have the same gap: they go on the optimistic transaction but not in the request. Fix those in the same PR if invoices should keep them.
@rojiphil you could also check an invoice in Classic in the meantime.
@trjExpensify Yeah... Billable option is not displayed in Classic as well. Whereas tag, taxCode and taxAmount remain displayed. I think we can go ahead and hide the billable toggle for invoices unless someone thinks differently.
https://github.com/user-attachments/assets/e8fe2109-28c3-406e-817e-fee3e8edce27
@MelvinBot Please refine the proposal. The objective is to hide the billable toggle for invoices.