fixed issue 25441: Price is set fine using unit price when qty is changed in orderline
authorGuillermo Alvarez de Eulate <guillermo.alvarez@openbravo.com>
Thu, 06 Feb 2014 11:27:59 +0100
changeset 21925 c385f03ea176
parent 21924 8b7a6ede079c
child 21926 8d694f6a34a3
fixed issue 25441: Price is set fine using unit price when qty is changed in orderline
src/org/openbravo/common/hooks/OrderLineQtyChangedHookObject.java
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
--- a/src/org/openbravo/common/hooks/OrderLineQtyChangedHookObject.java	Thu Feb 06 09:53:55 2014 +0100
+++ b/src/org/openbravo/common/hooks/OrderLineQtyChangedHookObject.java	Thu Feb 06 11:27:59 2014 +0100
@@ -2,6 +2,8 @@
 
 import java.math.BigDecimal;
 
+import org.openbravo.model.pricing.pricelist.PriceList;
+
 public class OrderLineQtyChangedHookObject {
 
   private String productId;
@@ -10,6 +12,8 @@
   private BigDecimal price;
   private String changed;
   private int pricePrecision;
+  private PriceList priceList;
+  private BigDecimal listPrice;
 
   public int getPricePrecision() {
     return pricePrecision;
@@ -63,4 +67,20 @@
     this.price = price;
   }
 
+  public PriceList getPriceList() {
+    return priceList;
+  }
+
+  public void setPriceList(PriceList priceList) {
+    this.priceList = priceList;
+  }
+
+  public BigDecimal getListPrice() {
+    return listPrice;
+  }
+
+  public void setListPrice(BigDecimal listPrice) {
+    this.listPrice = listPrice;
+  }
+
 }
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java	Thu Feb 06 09:53:55 2014 +0100
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java	Thu Feb 06 11:27:59 2014 +0100
@@ -110,8 +110,8 @@
     String strStockNoAttribute;
     String strStockAttribute;
     String strPriceActual = _strPriceActual;
-    boolean isTaxIncludedPriceList = OBDal.getInstance().get(PriceList.class, data[0].mPricelistId)
-        .isPriceIncludesTax();
+    PriceList currentPriceList = OBDal.getInstance().get(PriceList.class, data[0].mPricelistId);
+    boolean isTaxIncludedPriceList = currentPriceList.isPriceIncludesTax();
     boolean isGrossUnitPriceChanged = strChanged.equals("inpgrossUnitPrice");
     boolean forceSetPriceStd = false;
     if (data1 != null && data1.length > 0) {
@@ -158,10 +158,13 @@
         hookObject.setQty(qtyOrdered);
         hookObject.setOrderId(strCOrderId);
         hookObject.setPricePrecision(pricePrecision);
+        hookObject.setPriceList(currentPriceList);
         if (isTaxIncludedPriceList) {
-          hookObject.setPrice(grossPriceList);
+          hookObject.setListPrice(grossPriceList);
+          hookObject.setPrice(grossBaseUnitPrice);
         } else {
-          hookObject.setPrice(netPriceList);
+          hookObject.setListPrice(netPriceList);
+          hookObject.setPrice(priceStd);
         }
 
         hookObject.setChanged(strChanged);