details:   https://code.openbravo.com/erp/devel/pi/rev/d4a038cf2708
changeset: 25742:d4a038cf2708
user:      Unai Martirena <unai.martirena <at> openbravo.com>
date:      Thu Jan 22 17:05:07 2015 +0100
summary:   Fixes bug 28640:Res. line with amt released not duplicated in Manage 
Reservation

The problem is that when opening Manage Reservations P&E from sales order line, 
the property 'reservationStock' comes blank, even when a reservation stock line 
exists (When there is no reservation for the sales orderline a temporary one is 
created just to display lines in the selector selected correctly, and after 
that is deleted. This happens in the datasource of the P&E). In this cases the 
Manage Reservations action handler deletes these lines y they exists and 
creates new ones. But this is not possible for already released lines, so it 
was creating a duplicate of those.

In order to fix this, the property 'id' is used (allways comes with a value) in 
the case that the reservation is released, because in this case for sure that 
the reservation stock line exists, so it will update the existing one instead 
of creating a new one.

diffstat:

 src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java |  
15 ++++++++-
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r 3e5c7b3e8a8f -r d4a038cf2708 
src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java
--- 
a/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java    
    Thu Jan 22 11:14:24 2015 +0100
+++ 
b/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java    
    Thu Jan 22 17:05:07 2015 +0100
@@ -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-2014 Openbravo SLU 
+ * All portions are Copyright (C) 2013-2015 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -135,6 +135,17 @@
       String strReservationStockId = 
selectedLine.get("reservationStock").equals(null) ? ""
           : selectedLine.getString("reservationStock");
       boolean existsReservationStock = 
StringUtils.isNotBlank(strReservationStockId);
+      if (!existsReservationStock) {
+        String released = selectedLine.get("released").equals(null) ? "" : 
selectedLine
+            .getString("released");
+        if (StringUtils.isNotBlank(released)) {
+          BigDecimal qtyReleased = new BigDecimal(released);
+          if (qtyReleased.compareTo(BigDecimal.ZERO) != 0) {
+            strReservationStockId = selectedLine.getString("id");
+            existsReservationStock = true;
+          }
+        }
+      }
       if (existsReservationStock) {
         resStock = OBDal.getInstance().get(ReservationStock.class, 
strReservationStockId);
         idList.remove(strReservationStockId);
@@ -186,7 +197,7 @@
     if (idList.size() > 0) {
       for (String id : idList) {
         ReservationStock resStock = 
OBDal.getInstance().get(ReservationStock.class, id);
-        if(resStock.getReleased() == null
+        if (resStock.getReleased() == null
             || resStock.getReleased().compareTo(BigDecimal.ZERO) == 0) {
           reservation.getMaterialMgmtReservationStockList().remove(resStock);
           OBDal.getInstance().remove(resStock);

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to