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

jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 1f40d4c81befd0d80ba47e781a219f94a127f946
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Sat Aug 27 12:14:48 2022 +0200

    Fixed: Tax calculation not considering productStoreGroup (OFBIZ-12686)
    
    As reported by Ingo the productStoreId field does not exist in the 
ProductPrice
    entity, it's productStoreGroupId. This fixes it
    
    Thanks: Ingo for issue report
---
 .../ofbiz/accounting/tax/TaxAuthorityServices.java | 23 +++++++---------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git 
a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java
 
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java
index 0704c2e07b..abc0e64a1a 100644
--- 
a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java
+++ 
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java
@@ -659,22 +659,13 @@ public class TaxAuthorityServices {
      */
     private static GenericValue getProductPrice(Delegator delegator, 
GenericValue product, GenericValue productStore, String taxAuthGeoId,
             String taxAuthPartyId) throws GenericEntityException {
-        if 
(UtilValidate.isNotEmpty(productStore.getString("primaryStoreGroupId"))) {
-            return EntityQuery.use(delegator).from("ProductPrice")
-                    .where("productId", product.get("productId"),
-                            "taxAuthPartyId", taxAuthPartyId,
-                            "taxAuthGeoId", taxAuthGeoId,
-                            "productPricePurposeId", "PURCHASE",
-                            "productStoreId", 
productStore.get("primaryStoreGroupId"))
-                    .orderBy("-fromDate").filterByDate().queryFirst();
-        } else {
-            return EntityQuery.use(delegator).from("ProductPrice")
-                    .where("productId", product.get("productId"),
-                            "taxAuthPartyId", taxAuthPartyId,
-                            "taxAuthGeoId", taxAuthGeoId,
-                            "productPricePurposeId", "PURCHASE")
-                            .orderBy("-fromDate").filterByDate().queryFirst();
-        }
+        return EntityQuery.use(delegator).from("ProductPrice")
+                .where("productId", product.get("productId"),
+                        "taxAuthPartyId", taxAuthPartyId,
+                        "taxAuthGeoId", taxAuthGeoId,
+                        "productPricePurposeId", "PURCHASE",
+                        "productStoreGroupId", 
productStore.get("primaryStoreGroupId"))
+                .orderBy("-fromDate").filterByDate().queryFirst();
     }
 
     /**

Reply via email to