diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d48567ebdaf3..8e78dead4a93 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -150,6 +150,7 @@ type OptimisticExpenseReport = Pick< | 'policyID' | 'type' | 'ownerAccountID' + | 'managerID' | 'currency' | 'reportName' | 'stateNum' @@ -2704,7 +2705,7 @@ function buildOptimisticExpenseReport(chatReportID: string, policyID: string, pa const stateNum = isFree ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.OPEN; const statusNum = isFree ? CONST.REPORT.STATUS_NUM.SUBMITTED : CONST.REPORT.STATUS_NUM.OPEN; - return { + const expenseReport: OptimisticExpenseReport = { reportID: generateReportID(), chatReportID, policyID, @@ -2721,6 +2722,13 @@ function buildOptimisticExpenseReport(chatReportID: string, policyID: string, pa parentReportID: chatReportID, lastVisibleActionCreated: DateUtils.getDBTime(), }; + + // The account defined in the policy submitsTo field is the approver/ manager for this report + if (policy?.submitsTo) { + expenseReport.managerID = policy.submitsTo; + } + + return expenseReport; } /**