Fixed issue 24788.Automatically reserve remaining after updating to CO.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Wed, 18 Sep 2013 10:10:40 +0200
changeset 21157 2e9ce78cf1e3
parent 21156 39c2826be99e
child 21158 294807c9658f
Fixed issue 24788.Automatically reserve remaining after updating to CO.
src-db/database/model/functions/M_RESERVATION_POST.xml
--- a/src-db/database/model/functions/M_RESERVATION_POST.xml	Tue Sep 17 15:52:35 2013 +0200
+++ b/src-db/database/model/functions/M_RESERVATION_POST.xml	Wed Sep 18 10:10:40 2013 +0200
@@ -272,8 +272,6 @@
                             END
         WHERE c_order_id = v_sales_order_id;
       END IF;
-      -- ADD RESERVED STOCK
-      M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message);
 
       v_newstatus := 'CO';
       v_newaction := 'HO';
@@ -401,6 +399,11 @@
       updatedby = v_user_id
   WHERE m_reservation_id = v_reservation_id;
 
+  IF (v_resaction = 'PR') THEN
+    -- ADD RESERVED STOCK
+    M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message);
+  END IF;
+
   IF (p_pinstance_id IS NOT NULL) THEN
     DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
     AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', v_Result, v_Message) ;