From 74430243fceb48979e0025cffb408970e2d0ca81 Mon Sep 17 00:00:00 2001 From: Anahita Goljahani Date: Fri, 13 Feb 2026 10:15:02 +0100 Subject: [PATCH] Ensure that the invoice item quantity is set to 1 only if the quantity is null when invoice items are created by the createInvoiceItem service --- .../ofbiz/accounting/invoice/InvoiceServicesScript.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy index a3e2793e71f..eb9f75431ee 100644 --- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy +++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy @@ -350,7 +350,7 @@ Map createInvoiceItem() { // if there is no amount and a productItem is supplied fill the amount(price) and description from the product record // TODO: there are return adjustments now that make this code very broken. The check for price was added as a quick fix. if (invoiceItem.productId) { - invoiceItem.quantity = invoiceItem.quantity ?: 1 + invoiceItem.quantity = (invoiceItem.quantity != null) ? invoiceItem.quantity : 1 if (!invoiceItem.amount) { GenericValue product = from('Product').where(parameters).cache().queryOne() invoiceItem.description = product.description