@@ -4097,8 +4097,17 @@ function buildOptimisticInvoiceReport(chatReportID: string, policyID: string, re
4097
4097
* @param total - Amount in cents
4098
4098
* @param currency
4099
4099
* @param reimbursable – Whether the expense is reimbursable
4100
+ * @param parentReportActionID – The parent ReportActionID of the PolicyExpenseChat
4100
4101
*/
4101
- function buildOptimisticExpenseReport ( chatReportID : string , policyID : string , payeeAccountID : number , total : number , currency : string , reimbursable = true ) : OptimisticExpenseReport {
4102
+ function buildOptimisticExpenseReport (
4103
+ chatReportID : string ,
4104
+ policyID : string ,
4105
+ payeeAccountID : number ,
4106
+ total : number ,
4107
+ currency : string ,
4108
+ reimbursable = true ,
4109
+ parentReportActionID ?: string ,
4110
+ ) : OptimisticExpenseReport {
4102
4111
// The amount for Expense reports are stored as negative value in the database
4103
4112
const storedTotal = total * - 1 ;
4104
4113
const policyName = getPolicyName ( ReportConnection . getAllReports ( ) ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReportID } ` ] ) ;
@@ -4126,6 +4135,7 @@ function buildOptimisticExpenseReport(chatReportID: string, policyID: string, pa
4126
4135
notificationPreference : CONST . REPORT . NOTIFICATION_PREFERENCE . HIDDEN ,
4127
4136
parentReportID : chatReportID ,
4128
4137
lastVisibleActionCreated : DateUtils . getDBTime ( ) ,
4138
+ parentReportActionID,
4129
4139
} ;
4130
4140
4131
4141
// Get the approver/manager for this report to properly display the optimistic data
@@ -4472,19 +4482,21 @@ function buildOptimisticSubmittedReportAction(amount: number, currency: string,
4472
4482
* @param iouReport
4473
4483
* @param [comment] - User comment for the IOU.
4474
4484
* @param [transaction] - optimistic first transaction of preview
4485
+ * @param reportActionID
4475
4486
*/
4476
4487
function buildOptimisticReportPreview (
4477
4488
chatReport : OnyxInputOrEntry < Report > ,
4478
4489
iouReport : Report ,
4479
4490
comment = '' ,
4480
4491
transaction : OnyxInputOrEntry < Transaction > = null ,
4481
4492
childReportID ?: string ,
4493
+ reportActionID ?: string ,
4482
4494
) : ReportAction < typeof CONST . REPORT . ACTIONS . TYPE . REPORT_PREVIEW > {
4483
4495
const hasReceipt = TransactionUtils . hasReceipt ( transaction ) ;
4484
4496
const message = getReportPreviewMessage ( iouReport ) ;
4485
4497
const created = DateUtils . getDBTime ( ) ;
4486
4498
return {
4487
- reportActionID : NumberUtils . rand64 ( ) ,
4499
+ reportActionID : reportActionID ?? NumberUtils . rand64 ( ) ,
4488
4500
reportID : chatReport ?. reportID ,
4489
4501
actionName : CONST . REPORT . ACTIONS . TYPE . REPORT_PREVIEW ,
4490
4502
pendingAction : CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ,
0 commit comments