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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new c6bd86d  Fixed: Explode items not handling tax and adjustments 
properly (OFBIZ-11928)
c6bd86d is described below

commit c6bd86d53ef9150a17607e8517b28baf09c5d49f
Author: Nicolas Malin <nicolas.ma...@nereide.fr>
AuthorDate: Mon Sep 27 18:31:32 2021 +0200

    Fixed: Explode items not handling tax and adjustments properly (OFBIZ-11928)
    
    If you set explodeItems to true on your productStore, tax and adjustment 
wasn't correctly calculate when you ordered some finish goods.
    
    Thanks: Suraj Khurana and Ankush Upadhyay
---
 .../java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git 
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
 
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
index 1fff629..3b46dd7 100644
--- 
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
+++ 
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
@@ -4413,6 +4413,16 @@ public class ShoppingCart implements 
Iterable<ShoppingCartItem>, Serializable {
                 result.add(orderItem);
                 // don't do anything with adjustments here, those will be 
added below in makeAllAdjustments
             }
+            // Recalculate tax only if items are exploded.
+            if (explodeItems) {
+                // calc the sales tax
+                CheckOutHelper coh = new CheckOutHelper(dispatcher, delegator, 
this);
+                try {
+                    coh.calcAndAddTax();
+                } catch (GeneralException e) {
+                    Debug.logError(e, MODULE);
+                }
+            }
             return result;
         }
     }

Reply via email to