Skip to content
8 changes: 3 additions & 5 deletions src/libs/actions/IOU/ReportWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import Navigation from '@libs/Navigation/Navigation';
import {getIsOffline} from '@libs/NetworkState';
// eslint-disable-next-line @typescript-eslint/no-deprecated
import {buildNextStepNew, buildOptimisticNextStep} from '@libs/NextStepUtils';
import {getAccountIDsByLogins} from '@libs/PersonalDetailsUtils';
import {arePaymentsEnabled, getSubmitToAccountID, hasDynamicExternalWorkflow, isPaidGroupPolicy, isPolicyAdmin, isSubmitAndClose} from '@libs/PolicyUtils';
import {getAllReportActions, getReportActionHtml, getReportActionText, hasPendingDEWApprove, isCreatedAction, isDeletedAction} from '@libs/ReportActionsUtils';
import {
Expand All @@ -30,7 +29,6 @@ import {
canBeAutoReimbursed,
canSubmitAndIsAwaitingForCurrentUser,
getAllHeldTransactions as getAllHeldTransactionsReportUtils,
getApprovalChain,
getMoneyRequestSpendBreakdown,
getNextApproverAccountID,
getReportOrDraftReport,
Expand Down Expand Up @@ -1298,8 +1296,8 @@ function submitReport({
isASAPSubmitBetaEnabled,
isUnapprove: true,
});
const approvalChain = getApprovalChain(policy, expenseReport);
const managerID = getAccountIDsByLogins(approvalChain).at(0);
const submitToAccountID = getSubmitToAccountID(policy, expenseReport);
const managerID = submitToAccountID > 0 ? submitToAccountID : expenseReport.managerID;

const optimisticData: Array<
OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS | typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.NEXT_STEP | typeof ONYXKEYS.COLLECTION.REPORT_METADATA>
Expand Down Expand Up @@ -1505,7 +1503,7 @@ function submitReport({

const parameters: SubmitReportParams = {
reportID: expenseReport.reportID,
managerAccountID: getSubmitToAccountID(policy, expenseReport) ?? expenseReport.managerID,
managerAccountID: managerID,
reportActionID: optimisticSubmittedReportAction.reportActionID,
};

Expand Down
Loading