details:   https://code.openbravo.com/erp/devel/pi/rev/237a498f9e4d
changeset: 21219:237a498f9e4d
user:      Javier Etxarri <javier.echarri <at> openbravo.com>
date:      Mon Sep 30 15:36:45 2013 +0200
summary:   Backout issue 24139: Available quantity
wrongly updated when voiding a goods shipment of a reactivated order

diffstat:

 src-db/database/model/functions/M_INOUT_POST.xml |  26 +++++------------------
 1 files changed, 6 insertions(+), 20 deletions(-)

diffs (43 lines):

diff -r 73df6c79ca82 -r 237a498f9e4d 
src-db/database/model/functions/M_INOUT_POST.xml
--- a/src-db/database/model/functions/M_INOUT_POST.xml  Mon Sep 30 17:25:31 
2013 +0530
+++ b/src-db/database/model/functions/M_INOUT_POST.xml  Mon Sep 30 15:36:45 
2013 +0200
@@ -47,7 +47,6 @@
   v_Message VARCHAR2(2000):='';
   v_Message_aux VARCHAR2(2000):='';
   v_Record_ID VARCHAR2(32);
-  v_DocStatus VARCHAR2(60);
   v_User VARCHAR2(32);
   v_PUser VARCHAR2(32);
   v_is_included NUMBER:=0;
@@ -603,25 +602,12 @@
               -- stocked product
               IF(Cur_InOutLine.M_Product_ID IS NOT NULL AND v_IsStocked=1) THEN
                 -- Update OrderLine (if C-, Qty is negative)
-                SELECT DOCSTATUS into v_DocStatus
-                FROM C_ORDER
-                WHERE C_ORDER_ID = (SELECT C_ORDER_ID
-                                    FROM C_ORDERLINE 
-                                    WHERE 
C_ORDERLINE_ID=Cur_InOutLine.C_OrderLine_ID);
-                IF (v_DocStatus = 'DR') THEN
-                  UPDATE C_ORDERLINE
-                    SET QtyDelivered=QtyDelivered + v_QtySO,
-                    Updated=now(),
-                    UpdatedBy=v_User
-                  WHERE C_OrderLine_ID=Cur_InOutLine.C_OrderLine_ID;
-                ELSE 
-                  UPDATE C_ORDERLINE
-                    SET QtyReserved=QtyReserved - v_QtyPO - v_QtySO,
-                    QtyDelivered=QtyDelivered + v_QtySO,
-                    Updated=now(),
-                    UpdatedBy=v_User
-                   WHERE C_OrderLine_ID=Cur_InOutLine.C_OrderLine_ID;
-                END IF;
+                UPDATE C_ORDERLINE
+                  SET QtyReserved=QtyReserved - v_QtyPO - v_QtySO,
+                  QtyDelivered=QtyDelivered + v_QtySO,
+                  Updated=now(),
+                  UpdatedBy=v_User
+                WHERE C_OrderLine_ID=Cur_InOutLine.C_OrderLine_ID;
                 -- Products not stocked
               ELSE
                 -- Update OrderLine (if C-, Qty is negative)

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to