Fixes Issue 28162:Cannot modify the reservation of a sales order line if it
authorAtul Gaware <atul.gaware@openbravo.com>
Fri, 14 Nov 2014 15:28:11 +0530
changeset 24095 a69540f3ab4d
parent 24094 4ccbe7a7da1d
child 24096 a6bf203d3fff
Fixes Issue 28162:Cannot modify the reservation of a sales order line if it
is partially reserved and released

Before removing reservation stock line check is provided to check whether
released qty is zero or not.
src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java
--- a/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java	Tue Nov 11 05:38:06 2014 +0000
+++ b/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java	Fri Nov 14 15:28:11 2014 +0530
@@ -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) 2013 Openbravo SLU 
+ * All portions are Copyright (C) 2013-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -186,8 +186,11 @@
     if (idList.size() > 0) {
       for (String id : idList) {
         ReservationStock resStock = OBDal.getInstance().get(ReservationStock.class, id);
-        reservation.getMaterialMgmtReservationStockList().remove(resStock);
-        OBDal.getInstance().remove(resStock);
+        if(resStock.getReleased() == null
+            || resStock.getReleased().compareTo(BigDecimal.ZERO) == 0) {
+          reservation.getMaterialMgmtReservationStockList().remove(resStock);
+          OBDal.getInstance().remove(resStock);
+        }
       }
       OBDal.getInstance().save(reservation);
       OBDal.getInstance().flush();