From 74f791541fe69a41e4f795df4510b7bbd88acd63 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 29 Oct 2021 13:48:17 -0700 Subject: [PATCH] IO-256 Resolve no invoice on CM QBO export. --- server/accounting/qbo/qbo-payments.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/accounting/qbo/qbo-payments.js b/server/accounting/qbo/qbo-payments.js index 2c80d96de..db503458a 100644 --- a/server/accounting/qbo/qbo-payments.js +++ b/server/accounting/qbo/qbo-payments.js @@ -384,7 +384,9 @@ async function InsertCreditMemo( }, TxnDate: moment(payment.date).format("YYYY-MM-DD"), DocNumber: payment.paymentnum, - ...(invoices[0] ? { InvoiceRef: { value: invoices[0].Id } } : {}), + ...(invoices && invoices[0] + ? { InvoiceRef: { value: invoices[0].Id } } + : {}), Line: [ { DetailType: "SalesItemLineDetail",