Skip to content

Commit 8f00485

Browse files
authored
Merge pull request Expensify#64737 from daledah/fix/63819
fix: show change workspace option for paid IOU
2 parents e430d01 + 30f117e commit 8f00485

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/libs/ReportUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4125,9 +4125,10 @@ function canEditReportPolicy(report: OnyxEntry<Report>, reportPolicy: OnyxEntry<
41254125
const isExpenseType = isExpenseReport(report);
41264126
const isOpen = isOpenReport(report);
41274127
const isSubmitted = isProcessingReport(report);
4128+
const isReimbursed = isReportManuallyReimbursed(report);
41284129

41294130
if (isIOUType) {
4130-
return isOpen || isSubmitted;
4131+
return isOpen || isSubmitted || isReimbursed;
41314132
}
41324133

41334134
if (isInvoiceType) {

src/libs/actions/Report.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ import {
147147
isMoneyRequestReport,
148148
isOpenExpenseReport,
149149
isProcessingReport,
150+
isReportManuallyReimbursed,
150151
isSelfDM,
151152
isUnread,
152153
isValidReportIDFromPath,
@@ -4960,8 +4961,10 @@ function moveIOUReportToPolicy(reportID: string, policyID: string) {
49604961
if (!policy || !iouReport || !isIOUReportUsingReport(iouReport)) {
49614962
return;
49624963
}
4964+
const isReimbursed = isReportManuallyReimbursed(iouReport);
4965+
49634966
// We do not want to create negative amount expenses
4964-
if (ReportActionsUtils.hasRequestFromCurrentAccount(iouReport.reportID, iouReport.managerID ?? CONST.DEFAULT_NUMBER_ID)) {
4967+
if (!isReimbursed && ReportActionsUtils.hasRequestFromCurrentAccount(reportID, iouReport.managerID ?? CONST.DEFAULT_NUMBER_ID)) {
49654968
return;
49664969
}
49674970

@@ -5140,8 +5143,10 @@ function moveIOUReportToPolicyAndInviteSubmitter(reportID: string, policyID: str
51405143
return;
51415144
}
51425145

5146+
const isReimbursed = isReportManuallyReimbursed(iouReport);
5147+
51435148
// We only allow moving IOU report to a policy if it doesn't have requests from multiple users, as we do not want to create negative amount expenses
5144-
if (ReportActionsUtils.hasRequestFromCurrentAccount(reportID, iouReport.managerID ?? CONST.DEFAULT_NUMBER_ID)) {
5149+
if (!isReimbursed && ReportActionsUtils.hasRequestFromCurrentAccount(reportID, iouReport.managerID ?? CONST.DEFAULT_NUMBER_ID)) {
51455150
return;
51465151
}
51475152

0 commit comments

Comments
 (0)