Skip to content

Commit 6d6b15c

Browse files
committed
enabling moving invoice when there is at least one outstanding expense report in the same policy
1 parent 9a88559 commit 6d6b15c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/libs/ReportUtils.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4230,6 +4230,17 @@ function canEditFieldOfMoneyRequest(reportAction: OnyxInputOrEntry<ReportAction>
42304230
if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.REPORT) {
42314231
// Unreported transaction from OldDot can have the reportID as an empty string
42324232
const isUnreportedExpense = !transaction?.reportID || transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID;
4233+
4234+
if (isInvoiceReport(moneyRequestReport) && !isUnreportedExpense) {
4235+
return (
4236+
getOutstandingReportsForUser(
4237+
moneyRequestReport?.policyID,
4238+
moneyRequestReport?.ownerAccountID,
4239+
reportsByPolicyID?.[moneyRequestReport?.policyID ?? CONST.DEFAULT_NUMBER_ID] ?? {},
4240+
).length > 0
4241+
);
4242+
}
4243+
42334244
return isUnreportedExpense
42344245
? Object.values(allPolicies ?? {}).flatMap((currentPolicy) =>
42354246
getOutstandingReportsForUser(currentPolicy?.id, currentUserAccountID, reportsByPolicyID?.[currentPolicy?.id ?? CONST.DEFAULT_NUMBER_ID] ?? {}),

0 commit comments

Comments
 (0)