details: https://code.openbravo.com/erp/devel/pi/rev/e32a6dfe59e6 changeset: 28094:e32a6dfe59e6 user: David Miguelez <david.miguelez <at> openbravo.com> date: Fri Dec 04 11:57:05 2015 +0100 summary: Fixes Issue 31514. Refreshes reservation object before checking status. Also, call to Reservation_Post process is moved to the end of the fucntion, after the lines have been modified.
diffstat: src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java | 21 +++++---- 1 files changed, 12 insertions(+), 9 deletions(-) diffs (40 lines): diff -r e867bcaa1cc6 -r e32a6dfe59e6 src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java --- a/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java Tue Dec 01 19:06:20 2015 +0100 +++ b/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java Fri Dec 04 11:57:05 2015 +0100 @@ -76,17 +76,10 @@ final OrderLine sol = OBDal.getInstance().get(OrderLine.class, strOrderLineId); reservation = ReservationUtils.getReservationFromOrder(sol); + OBDal.getInstance().refresh(reservation); processReservation = reservation.getRESStatus().equals("DR"); } - if (processReservation) { - OBError result = ReservationUtils.processReserve(reservation, "PR"); - if (result.getType().equals("Error")) { - JSONObject errorMessage = new JSONObject(); - errorMessage.put("severity", result.getType().toLowerCase()); - errorMessage.put("text", result.getMessage()); - jsonRequest.put("message", errorMessage); - } - } + if (reservation != null) { // FIXME: Replace with OBDao method when handler is merged with latest pi. // List<String> idList = OBDao.getIDListFromOBObject(reservation @@ -96,6 +89,16 @@ idList.add(resStock.getId()); } manageReservedStockLines(jsonRequest, reservation, idList); + + if (processReservation) { + OBError result = ReservationUtils.processReserve(reservation, "PR"); + if (result.getType().equals("Error")) { + JSONObject errorMessage = new JSONObject(); + errorMessage.put("severity", result.getType().toLowerCase()); + errorMessage.put("text", result.getMessage()); + jsonRequest.put("message", errorMessage); + } + } } } catch (Exception e) { ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits