details:   https://code.openbravo.com/erp/devel/pi/rev/6a599106f399
changeset: 32512:6a599106f399
user:      Armaignac <collazoandy4 <at> gmail.com>
date:      Thu Jul 20 10:41:52 2017 -0400
summary:   Fixes issue 36455: Cannot complete a shipment if related to a draft 
reservation

When a reservation was removed from Manage Reservation process in Sales Order,
the reservation keeps the association with the line and Not support operation
exception was raised because the reservation changes from DR to CL.

Now the Manage Reservation process in Sales Order removes the reservation
if the reservation has no lines.

Also the c_orderline2_trg only closes reservations in CO and HO status.

diffstat:

 src-db/database/model/triggers/C_ORDERLINE2_TRG.xml                        |  
2 +-
 src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java |  
6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 079acca81db9 -r 6a599106f399 
src-db/database/model/triggers/C_ORDERLINE2_TRG.xml
--- a/src-db/database/model/triggers/C_ORDERLINE2_TRG.xml       Tue Jul 04 
17:35:43 2017 +0200
+++ b/src-db/database/model/triggers/C_ORDERLINE2_TRG.xml       Thu Jul 20 
10:41:52 2017 -0400
@@ -90,7 +90,7 @@
              SELECT res.m_reservation_id as m_reservation_id
              FROM m_reservation res
              WHERE res.C_ORDERLINE_ID = :new.C_ORDERLINE_ID
-             AND res.RES_STATUS <> 'CL'
+             AND res.RES_STATUS IN ('CO', 'HO')
            ) LOOP
                M_RESERVATION_POST(null, cur_reservations.m_reservation_id, 
'CL', :new.updatedBy);
              END LOOP;
diff -r 079acca81db9 -r 6a599106f399 
src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java
--- 
a/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java    
    Tue Jul 04 17:35:43 2017 +0200
+++ 
b/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java    
    Thu Jul 20 10:41:52 2017 -0400
@@ -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-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2013-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -102,10 +102,12 @@
           idList.add(resStock.getId());
         }
         manageReservedStockLines(jsonRequest, reservation, idList);
-        // Force status to draft in case reservation has no lines
+        // Remove reservation in case reservation has no lines
         if (reservation.getMaterialMgmtReservationStockList().isEmpty()) {
           reservation.setRESStatus("DR");
           reservation.setRESProcess("PR");
+          OBDal.getInstance().flush();
+          OBDal.getInstance().remove(reservation);
         }
       }
 

------------------------------------------------------------------------------
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