Related To Issue 26887:Generate PL creates Stock reservation for no stock prod
authorAtul Gaware <atul.gaware@openbravo.com>
Wed, 13 Aug 2014 14:03:09 +0530
changeset 24270 e414f3f0e298
parent 24269 6f90c7d6a7d2
child 24271 8b3dea147b15
Related To Issue 26887:Generate PL creates Stock reservation for no stock prod
src-db/database/model/functions/M_RESERVATION_POST.xml
--- a/src-db/database/model/functions/M_RESERVATION_POST.xml	Wed Aug 06 15:41:34 2014 +0530
+++ b/src-db/database/model/functions/M_RESERVATION_POST.xml	Wed Aug 13 14:03:09 2014 +0530
@@ -47,6 +47,7 @@
   v_quantity        NUMBER;
   v_reservedqty     NUMBER;
   v_productname     m_product.name%TYPE;
+  v_countlines      NUMBER;
 
 TYPE RECORD IS REF CURSOR;
   Cur_Parameter RECORD;
@@ -277,6 +278,17 @@
 
       v_newstatus := 'CO';
       v_newaction := 'HO';
+      /* Do not process reservation's with no lines
+      */
+      v_countlines:=0;
+      SELECT COUNT(*) INTO v_countlines
+        FROM m_reservation_stock
+        WHERE m_reservation_id = v_reservation_id;
+      IF(v_countlines = 0) THEN
+	v_newstatus:='DR';
+	v_newaction:='PR';
+      END IF;
+
     END;
 
   ELSIF (v_resaction = 'HO') THEN