details:   https://code.openbravo.com/erp/devel/pi/rev/8642b9530182
changeset: 33955:8642b9530182
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Mon May 14 18:13:00 2018 +0530
summary:   Fixes Issue 38521: Operative quantity in goods shipment line
field gets overridden when using Create Lines From
functionality

Modifying AUM qty as per on hand qty in product selector
to be done only when receipt/shipment line is not linked
with order line

details:   https://code.openbravo.com/erp/devel/pi/rev/32cfd33daee1
changeset: 33956:32cfd33daee1
user:      Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date:      Mon May 14 18:21:41 2018 +0200
summary:   Related to issue 38521: Code review improvements

diffstat:

 src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java |  36 
++++-----
 1 files changed, 17 insertions(+), 19 deletions(-)

diffs (61 lines):

diff -r 27e680a3b013 -r 32cfd33daee1 
src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java Mon May 
14 17:18:34 2018 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java Mon May 
14 18:21:41 2018 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2017 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -105,32 +105,30 @@
     // However, if the delivery-note doesn't come from an order, it modifies
     // the quantity field with the quantity in the warehouse.
 
-    BigDecimal qty = BigDecimal.ZERO;
     String fromOrder = SLInOutLineProductData.fromOrder(this, strmInoutlineId);
+    boolean isUomManagementEnabled = UOMUtil.isUomManagementEnabled();
     if (fromOrder.equals("0")) {
       BigDecimal qtyOrder = StringUtils.isNotEmpty(strQtyOrder) ? new 
BigDecimal(strQtyOrder)
           : null;
-      qty = StringUtils.isNotEmpty(strQty) ? new BigDecimal(strQty) : null;
+      BigDecimal qty = StringUtils.isNotEmpty(strQty) ? new BigDecimal(strQty) 
: null;
       info.addResult("inpquantityorder", qtyOrder);
       info.addResult("inpmovementqty", qty);
-    }
 
-    boolean isUomManagementEnabled = UOMUtil.isUomManagementEnabled();
-    if (isUomManagementEnabled && 
productIsNotUsingSecondaryUom(strUOMProduct)) {
-      // Set AUM based on default
-      try {
-        OBContext.setAdminMode();
-        ShipmentInOut mInOut = OBDal.getInstance().get(ShipmentInOut.class,
-            info.vars.getStringParameter("inpmInoutId"));
-        String finalAUM = UOMUtil.getDefaultAUMForDocument(strMProductID, 
mInOut.getDocumentType()
-            .getId());
-        if (isValidUom(finalAUM)) {
-          info.addResult("inpcAum", finalAUM);
-          qty = StringUtils.isNotEmpty(strQty) ? new BigDecimal(strQty) : null;
-          info.addResult("inpaumqty", 
UOMUtil.getConvertedAumQty(strMProductID, qty, finalAUM));
+      if (isUomManagementEnabled && 
productIsNotUsingSecondaryUom(strUOMProduct)) {
+        // Set AUM based on default
+        try {
+          OBContext.setAdminMode();
+          ShipmentInOut mInOut = OBDal.getInstance().get(ShipmentInOut.class,
+              info.vars.getStringParameter("inpmInoutId"));
+          String finalAUM = UOMUtil.getDefaultAUMForDocument(strMProductID, 
mInOut
+              .getDocumentType().getId());
+          if (isValidUom(finalAUM)) {
+            info.addResult("inpcAum", finalAUM);
+            info.addResult("inpaumqty", 
UOMUtil.getConvertedAumQty(strMProductID, qty, finalAUM));
+          }
+        } finally {
+          OBContext.restorePreviousMode();
         }
-      } finally {
-        OBContext.restorePreviousMode();
       }
     }
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to