details:   https://code.openbravo.com/erp/devel/pi/rev/676e26599466
changeset: 30292:676e26599466
user:      Mark <markmm82 <at> gmail.com>
date:      Thu Sep 15 12:14:10 2016 -0400
summary:   Fixes issue 33838: Correct Stock Reservation when created from a 
closed order

When voiding a shipment related to a reserved order, if order is closed, new 
reservation will not be created (in case order was fully shipped) and existing 
reservation will not be updated (in case order was partially shipped).
Besides, when closing an order, related reservation will be also closed.

diffstat:

 src-db/database/model/functions/C_ORDER_POST1.xml |  1 +
 src-db/database/model/functions/M_INOUT_POST.xml  |  3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

diffs (28 lines):

diff -r 61036197bbae -r 676e26599466 
src-db/database/model/functions/C_ORDER_POST1.xml
--- a/src-db/database/model/functions/C_ORDER_POST1.xml Thu Sep 15 14:04:47 
2016 +0200
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml Thu Sep 15 12:14:10 
2016 -0400
@@ -1325,6 +1325,7 @@
                   END IF;
                   UPDATE m_reservation
                   SET quantity = cur_orderline.qtyordered,
+                      res_status = 'CL',
                       updated = now(),
                       updatedby = v_user
                   WHERE m_reservation_id = v_reservation_id;
diff -r 61036197bbae -r 676e26599466 
src-db/database/model/functions/M_INOUT_POST.xml
--- a/src-db/database/model/functions/M_INOUT_POST.xml  Thu Sep 15 14:04:47 
2016 +0200
+++ b/src-db/database/model/functions/M_INOUT_POST.xml  Thu Sep 15 12:14:10 
2016 -0400
@@ -1180,10 +1180,13 @@
               JOIN M_INOUTLINE iol
               ON ol.c_orderline_id = iol.c_orderline_id
               AND ol.m_product_id = iol.m_product_id
+              JOIN C_ORDER o
+              ON ol.c_order_id = o.c_order_id
               WHERE iol.m_inout_id = Cur_InOut.m_inout_id
               AND r.res_status <> 'DR'
               AND iol.movementqty > 0
               AND iol.canceled_inoutline_id IS NULL
+              AND o.docstatus <> 'CL'
               AND r.created = (
                 SELECT max(created)
                 FROM M_RESERVATION

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to