From 64d7e51c1722a0278ff635ad63c56d53769c5e72 Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Wed, 8 Oct 2025 13:48:52 +0000 Subject: [PATCH 1/2] =?UTF-8?q?Fix=20Reimbursable=20Toggle=20Missing=20for?= =?UTF-8?q?=20Collect=20Workspace=20Users=20=E2=80=94=20Expenses=20Default?= =?UTF-8?q?ing=20to=20Non-Reimbursable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MoneyRequestConfirmationListFooter.tsx | 6 +++++- src/components/ReportActionItem/MoneyRequestView.tsx | 7 ++++++- src/libs/actions/Policy/Policy.ts | 6 ++++-- src/pages/iou/request/step/IOURequestStepConfirmation.tsx | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/components/MoneyRequestConfirmationListFooter.tsx b/src/components/MoneyRequestConfirmationListFooter.tsx index 29974e5742a..b74a7bfb829 100644 --- a/src/components/MoneyRequestConfirmationListFooter.tsx +++ b/src/components/MoneyRequestConfirmationListFooter.tsx @@ -361,7 +361,11 @@ function MoneyRequestConfirmationListFooter({ const canModifyTaxFields = !isReadOnly && !isDistanceRequest && !isPerDiemRequest; // A flag for showing the billable field const shouldShowBillable = policy?.disabledFields?.defaultBillable === false; - const shouldShowReimbursable = isPolicyExpenseChat && policy?.disabledFields?.reimbursable === false && !isCardTransaction(transaction) && !isTypeInvoice; + const shouldShowReimbursable = + isPolicyExpenseChat && + (policy?.disabledFields?.reimbursable === false || (policy?.disabledFields?.reimbursable === undefined && policy?.defaultReimbursable === undefined)) && + !isCardTransaction(transaction) && + !isTypeInvoice; // Calculate the formatted tax amount based on the transaction's tax amount and the IOU currency code const taxAmount = getTaxAmount(transaction, false); const formattedTaxAmount = convertToDisplayString(taxAmount, iouCurrencyCode); diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 4b0f219130d..0da8bf2b341 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -270,7 +270,12 @@ function MoneyRequestView({ const isCurrentTransactionReimbursableDifferentFromPolicyDefault = policy?.defaultReimbursable !== undefined && !!(updatedTransaction?.reimbursable ?? transactionReimbursable) !== policy.defaultReimbursable; const shouldShowReimbursable = - isPolicyExpenseChat && (!policy?.disabledFields?.reimbursable || isCurrentTransactionReimbursableDifferentFromPolicyDefault) && !isCardTransaction && !isInvoice; + isPolicyExpenseChat && + (!policy?.disabledFields?.reimbursable || + (policy?.disabledFields?.reimbursable === undefined && policy?.defaultReimbursable === undefined) || + isCurrentTransactionReimbursableDifferentFromPolicyDefault) && + !isCardTransaction && + !isInvoice; const canEditReimbursable = isEditable && canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.REIMBURSABLE, undefined, isChatReportArchived); const shouldShowAttendees = useMemo(() => shouldShowAttendeesTransactionUtils(iouType, policy), [iouType, policy]); diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 9694b749ae3..06b3733880d 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -2499,8 +2499,9 @@ function createDraftWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policy reimbursementChoice: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, }, defaultBillable: false, - disabledFields: {defaultBillable: true}, + disabledFields: {defaultBillable: true, reimbursable: false}, requiresCategory: true, + defaultReimbursable: true, }, }, { @@ -3381,8 +3382,9 @@ function createWorkspaceFromIOUPayment(iouReport: OnyxEntry): WorkspaceF reimbursementChoice: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, }, defaultBillable: false, - disabledFields: {defaultBillable: true}, + disabledFields: {defaultBillable: true, reimbursable: false}, requiresCategory: true, + defaultReimbursable: true, }; const optimisticData: OnyxUpdate[] = [ diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 912259ac396..279961b129e 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -299,7 +299,7 @@ function IOURequestStepConfirmation({ }, [transactionIDs, defaultBillable]); useEffect(() => { - const defaultReimbursable = isPolicyExpenseChat && isPaidGroupPolicy(policy) ? !!policy?.defaultReimbursable : true; + const defaultReimbursable = isPolicyExpenseChat && isPaidGroupPolicy(policy) ? (policy?.defaultReimbursable ?? true) : true; transactionIDs.forEach((transactionID) => { setMoneyRequestReimbursable(transactionID, defaultReimbursable); }); From 7f3ae1fbe6259d72bd51d86bb430f7ea312251cc Mon Sep 17 00:00:00 2001 From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com> Date: Wed, 8 Oct 2025 17:12:20 +0000 Subject: [PATCH 2/2] apply clean up --- src/components/MoneyRequestConfirmationListFooter.tsx | 6 +----- src/components/ReportActionItem/MoneyRequestView.tsx | 7 +------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/components/MoneyRequestConfirmationListFooter.tsx b/src/components/MoneyRequestConfirmationListFooter.tsx index b74a7bfb829..f045e88917f 100644 --- a/src/components/MoneyRequestConfirmationListFooter.tsx +++ b/src/components/MoneyRequestConfirmationListFooter.tsx @@ -361,11 +361,7 @@ function MoneyRequestConfirmationListFooter({ const canModifyTaxFields = !isReadOnly && !isDistanceRequest && !isPerDiemRequest; // A flag for showing the billable field const shouldShowBillable = policy?.disabledFields?.defaultBillable === false; - const shouldShowReimbursable = - isPolicyExpenseChat && - (policy?.disabledFields?.reimbursable === false || (policy?.disabledFields?.reimbursable === undefined && policy?.defaultReimbursable === undefined)) && - !isCardTransaction(transaction) && - !isTypeInvoice; + const shouldShowReimbursable = isPolicyExpenseChat && policy?.disabledFields?.reimbursable !== true && !isCardTransaction(transaction) && !isTypeInvoice; // Calculate the formatted tax amount based on the transaction's tax amount and the IOU currency code const taxAmount = getTaxAmount(transaction, false); const formattedTaxAmount = convertToDisplayString(taxAmount, iouCurrencyCode); diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 0da8bf2b341..046e6a8017a 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -270,12 +270,7 @@ function MoneyRequestView({ const isCurrentTransactionReimbursableDifferentFromPolicyDefault = policy?.defaultReimbursable !== undefined && !!(updatedTransaction?.reimbursable ?? transactionReimbursable) !== policy.defaultReimbursable; const shouldShowReimbursable = - isPolicyExpenseChat && - (!policy?.disabledFields?.reimbursable || - (policy?.disabledFields?.reimbursable === undefined && policy?.defaultReimbursable === undefined) || - isCurrentTransactionReimbursableDifferentFromPolicyDefault) && - !isCardTransaction && - !isInvoice; + isPolicyExpenseChat && (policy?.disabledFields?.reimbursable !== true || isCurrentTransactionReimbursableDifferentFromPolicyDefault) && !isCardTransaction && !isInvoice; const canEditReimbursable = isEditable && canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.REIMBURSABLE, undefined, isChatReportArchived); const shouldShowAttendees = useMemo(() => shouldShowAttendeesTransactionUtils(iouType, policy), [iouType, policy]);