This is an automated email from the ASF dual-hosted git repository.

mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 7d1054a0e Fixed: FactServices child invoice item filtering and order 
lookup regressions (OFBIZ-13536)
7d1054a0e is described below

commit 7d1054a0e7156127553d56c521a3b4fcfecbefae
Author: Mridul Pathak <[email protected]>
AuthorDate: Thu Sep 10 15:51:23 2026 +0530

    Fixed: FactServices child invoice item filtering and order lookup 
regressions (OFBIZ-13536)
    
    - Filter child invoice items by invoiceItemTypeId for taxes (ITM_SALES_TAX) 
and discounts (ITM_PROMOTION_ADJ) in loadSalesInvoiceItemFact
    - Assign lookup results back to orderHeader and orderItem in 
loadSalesOrderItemFact
---
 bi/src/main/groovy/org/apache/ofbiz/bi/FactServices.groovy | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bi/src/main/groovy/org/apache/ofbiz/bi/FactServices.groovy 
b/bi/src/main/groovy/org/apache/ofbiz/bi/FactServices.groovy
index 831cf05cf..6744e48ec 100644
--- a/bi/src/main/groovy/org/apache/ofbiz/bi/FactServices.groovy
+++ b/bi/src/main/groovy/org/apache/ofbiz/bi/FactServices.groovy
@@ -140,14 +140,14 @@ Map loadSalesInvoiceItemFact() {
         }
 
         // taxes
-        List taxes = delegator.getRelated('ChildrenInvoiceItem', null, null, 
invoiceItem, false)
+        List taxes = delegator.getRelated('ChildrenInvoiceItem', 
[invoiceItemTypeId: 'ITM_SALES_TAX'], null, invoiceItem, false)
         for (GenericValue tax : taxes) {
             if (tax.amount) {
                 fact.extTaxAmount = fact.extTaxAmount + tax.amount
             }
         }
         // discounts
-        List discounts = delegator.getRelated('ChildrenInvoiceItem', null, 
null, invoiceItem, false)
+        List discounts = delegator.getRelated('ChildrenInvoiceItem', 
[invoiceItemTypeId: 'ITM_PROMOTION_ADJ'], null, invoiceItem, false)
         for (GenericValue discount : discounts) {
             if (discount.amount) {
                 fact.extDiscountAmount = fact.extDiscountAmount - 
discount.amount
@@ -205,8 +205,8 @@ Map loadSalesOrderItemFact() {
     List orderAdjustments
     GenericValue orderStatus
 
-    orderHeader ?: from('OrderHeader').where(parameters).queryOne()
-    orderItem ?: this.from('OrderItem').where(parameters).queryOne()
+    orderHeader = orderHeader ?: 
from('OrderHeader').where(parameters).queryOne()
+    orderItem = orderItem ?: from('OrderItem').where(parameters).queryOne()
     if (!orderAdjustment) {
         orderAdjustments = from('OrderAdjustment').where('orderId': 
orderItem.orderId).queryList()
     }

Reply via email to