details: https://code.openbravo.com/erp/devel/pi/rev/26448a5e9156 changeset: 21195:26448a5e9156 user: Javier Etxarri <javier.echarri <at> openbravo.com> date: Wed Sep 25 23:37:41 2013 +0200 summary: Fixes 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, 20 insertions(+), 6 deletions(-) diffs (43 lines): diff -r 83c0e902a8f6 -r 26448a5e9156 src-db/database/model/functions/M_INOUT_POST.xml --- a/src-db/database/model/functions/M_INOUT_POST.xml Wed Sep 25 19:55:16 2013 +0200 +++ b/src-db/database/model/functions/M_INOUT_POST.xml Wed Sep 25 23:37:41 2013 +0200 @@ -47,6 +47,7 @@ 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; @@ -590,12 +591,25 @@ -- stocked product IF(Cur_InOutLine.M_Product_ID IS NOT NULL AND v_IsStocked=1) THEN -- Update OrderLine (if C-, Qty is negative) - 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; + 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; -- 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